Task: | Lumimyrsky |
Sender: | Akaseli |
Submission time: | 2023-10-30 09:56:44 +0200 |
Language: | C++ (C++20) |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp:7:1: error: expected unqualified-id before 'int' 7 | int prevB = 0; | ^~~ input/code.cpp: In function 'int main()': input/code.cpp:25:14: error: 'prevB' was not declared in this scope; did you mean 'prevA'? 25 | if(x-prevB>0){ | ^~~~~ | prevA input/code.cpp:28:9: error: 'prevB' was not declared in this scope; did you mean 'prevA'? 28 | prevB = x; | ^~~~~ | prevA
Code
#include <bits/stdc++.h> using namespace std; int prevA = 0, int prevB = 0; int nousuA = 0; int nousuB = 0; int main(){ for(int i = 0; i<10; i++){ int x; cin >> x; if(x-prevA>0){ nousuA += x; } prevA = x; } for(int i = 0; i<10; i++){ int x; cin >> x; if(x-prevB>0){ nousuB += x; } prevB = x; } if(nousuA<nousuB){ cout << "1"; } else{ cout << "2"; } }