| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 138692 | 李朋秦 | 火车上的人数 | C++ | Accepted | 0 MS | 268 KB | 455 | 2025-11-29 14:32:24 |
#include<bits/stdc++.h> using namespace std; int m,c[16]={0}; int main() { int a,n,x,up[16]={0},down[16]={0}; cin>>a>>n>>m>>x; up[0]=a;c[0]=a;c[1]=a; for(int i=0;i<m;i++){//人数 up[1]=i;down[1]=i; for(int j=2;j<n-1;j++){ up[j]=up[j-1]+up[j-2]; down[j]=up[j-1]; c[j]=up[j]-down[j]+c[j-1]; } if(c[n-2]==m){ cout<<c[x-1]; return 0; } } cout<<"No answer."; return 0; }