| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 161008 | 李沐阳 | 火车上的人数 | C++ | Accepted | 1 MS | 268 KB | 402 | 2026-09-27 09:46:05 |
#include<bits/stdc++.h> using namespace std; int main(){ int a,n,m,x,sc[16]={},xc[16]={},r[16]={}; cin>>a>>n>>m>>x; sc[1]=r[1]=r[2]=a; xc[1]=0; for(int i=0;i<m;i++){ sc[2]=xc[2]=i; for(int j=3;j<n;j++){ sc[j]=sc[j-1]+sc[j-2]; xc[j]=sc[j-1]; r[j]=r[j-1]+sc[j-2]; } if(r[n-1]==m){ cout<<r[x]<<endl; return 0; } } cout<<"No answer."<<endl; return 0; }