Problem arrayproblem
User penguinzzz
Submission Time 2024-04-23 20:18:30
Score 0
Max Time N/A
Max Memory N/A

Compile Error

arrayproblem.cpp: In function ‘int main()’:
arrayproblem.cpp:8:6: error: ‘n’ was not declared in this scope; did you mean ‘yn’?
8 | int n, k; cin >> n >> k;
| ^
| yn
arrayproblem.cpp:8:9: error: ‘k’ was not declared in this scope
8 | int n, k; cin >> n >> k;
| ^
arrayproblem.cpp:9:9: error: ‘a’ was not declared in this scope
9 | int a[n], sum[n];
| ^
arrayproblem.cpp:9:15: error: ‘sum’ was not declared in this scope
9 | int a[n], sum[n];
| ^~~
arrayproblem.cpp:11:14: error: ‘i’ was not declared in this scope
11 | for (int i = 0; i < n; ++i) cin >> a[i];
| ^
arrayproblem.cpp:14:14: error: ‘i’ was not declared in this scope
14 | for (int i = 1; i < n; ++i) sum[i] = sum[i-1] + a[i];
| ^
arrayproblem.cpp:16:9: error: ‘ans’ was not declared in this sc