/ SeriousOJ /

Record Detail

Compile Error

foo.cc: In function 'int main()':
foo.cc:3:5: error: 'cin' was not declared in this scope
    3 |     cin >> T;
      |     ^~~
foo.cc:6:9: error: 'string' was not declared in this scope
    6 |         string S;
      |         ^~~~~~
foo.cc:7:21: error: 'S' was not declared in this scope
    7 |         cin >> N >> S;
      |                     ^
foo.cc:8:19: error: 'count' was not declared in this scope
    8 |         int one = count(S.begin(), S.end(), '1');
      |                   ^~~~~
foo.cc:10:9: error: 'cout' was not declared in this scope
   10 |         cout << max(one,zero) << endl;
      |         ^~~~
foo.cc:10:17: error: 'max' was not declared in this scope
   10 |         cout << max(one,zero) << endl;
      |                 ^~~
foo.cc:10:34: error: 'endl' was not declared in this scope
   10 |         cout << max(one,zero) << endl;
      |                                  ^~~~

Code

int main(){
    int T;
    cin >> T;
    while(T--) {
        int N;
        string S;
        cin >> N >> S;
        int one = count(S.begin(), S.end(), '1');
        int zero = N-one;
        cout << max(one,zero) << endl;
        }
}

Information

Submit By
Type
Submission
Problem
P1113 Fliping Game
Contest
Brain Booster #7
Language
C++17 (G++ 13.2.0)
Submit At
2024-11-05 15:20:15
Judged At
2024-11-11 02:30:53
Judged By
Score
0
Total Time
0ms
Peak Memory
0 Bytes