| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 161007 | 张蔚林 | 火车上的人数 | C++ | Runtime Error | 1 MS | 272 KB | 428 | 2026-09-27 09:43:56 |
#include<bits/stdc++.h> using namespace std; int main() { long long a,n,m,x,sc[16]={},xc[16]={},r[16]={}; cin>>a>>n>>m>>x; r[1]=r[2]=a; sc[1]=a; xc[1]=0; for(int i=0;i<m;i++){ sc[2]=i; xc[2]=i; for(int j=3;j<n;j++){ sc[i]=sc[i-1]+sc[i-2]; xc[i]=sc[i-1]; r[i]=r[i-1]+sc[i-2]; } if(r[n-1]==m){ cout<<r[x]; return 0; } } cout<<"No answer."<<endl; return 0; }
*** stack smashing detected ***: ./Main terminated