Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3799 吴奕希 火车上的人数 C++ Wrong Answer 0 MS 268 KB 340 2024-07-06 12:16:15

Tests(0/5):


Code:

# include<iostream> using namespace std; int main(){ int p_1=0, p_2=0, a, n, m, x; cin>>a>>n>>m>>x; p_1=a; for(int i = 3; i <= x; i++){ int l = p_1+p_2; a += p_1+p_2; a -= p_2; p_1 = p_2; p_2 = l; } if(a>=0)cout<<a; else cout<<"No answer."; return 0; }


Run Info:

------Input------
1 6 7 4
------Answer-----
4
------Your output-----
2