| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 161009 | 张蔚林 | 火车上的人数 | C++ | Accepted | 1 MS | 272 KB | 428 | 2026-09-27 09:46:12 |
#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 j=0;j<m;j++){ sc[2]=j; xc[2]=j; for(int i=3;i<n;i++){ 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; }