Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3682 吴奕希 火车上的人数 C++ Wrong Answer 0 MS 252 KB 645 2024-06-22 17:50:02

Tests(0/5):


Code:

#include <iostream> using namespace std; long calc(long p, long pp) { return p + pp; } int main() { long a, n, m, x; cin >> a >> n >> m >> x; if (x <= 2) { cout << a << endl; return 0; } long o, pp = a, p = a; long tot = a; for (int i = 3; i < n; ++i) { long on = calc(p, pp); if (i < n - 1) { tot += on - p; pp = p; p = on; } else if (tot - p + on != m) { cout << "No." << endl; return 0; } } cout << tot << endl; return 0; }


Run Info:

------Input------
1 6 7 4
------Answer-----
4
------Your output-----
No.