Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
3681 吴奕希 火车上的人数 C++ Compile Error 0 MS 0 KB 632 2024-06-22 17:48:58

Tests(0/0):


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; 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:

Main.cc: In function 'int main()':
Main.cc:18:13: error: 'tot' was not declared in this scope
             tot += on - p;
             ^
Main.cc:21:20: error: 'tot' was not declared in this scope
         } else if (tot - p + on != m) {  
                    ^
Main.cc:26:13: error: 'tot' was not declared in this scope
     cout < tot << endl;
             ^
Main.cc:14:10: warning: unused variable 'o' [-Wunused-variable]
     long o, pp = a, p = a;
          ^