Problem firstabc
User christal
Submission Time 2023-12-06 09:41:55
Score 0
Max Time N/A
Max Memory N/A

Compile Error

firstabc.cpp: In function ‘int main()’:
firstabc.cpp:10:5: error: expected initializer before ‘int’
10 | int ans = (n * (n + 1)) / 2;
| ^~~
firstabc.cpp:17:25: error: ‘n’ was not declared in this scope
17 | for (int i = 0; i < n; i++) {
| ^
firstabc.cpp:21:13: error: ‘str’ was not declared in this scope; did you mean ‘std’?
21 | if (str[i] == 'a') {
| ^~~
| std
firstabc.cpp:23:13: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
23 | ans += min(b_index, c_index);
| ^~~
| abs
firstabc.cpp:30:13: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
30 | ans += min(a_index, c_index);
| ^~~
| abs
firstabc.cpp:37:13: error: ‘ans’ was not declared in this scope; did you mean ‘abs’?
37 | a