Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
123284 任艺宸 火车上的人数 C++ Wrong Answer 0 MS 264 KB 707 2025-06-28 17:35:42

Tests(0/5):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int a,n,m,x; cin>>a>>n>>m>>x; int up[16]={0}; int down[16]={0}; int people[16]={0}; up[1]=a; down[1]=0; people[1]=a; for(int b=0;b<=m;b++){ up[2]=b; down[2]=b; people[2]=a; } for(int i=3;i<n;i++){ up[i]=up[i-1]+up[i-2]; down[i]=up[i-1]; people[i]=people[i-1]+up[i]-down[i]; } if(people[n-1]==m){ cout<<people[x]<<endl; } return 0; }


Run Info:

------Input------
10 6 30 4
------Answer-----
20
------Your output-----