Wrong Answer
Code
#include <iostream>
#include <string>
#include <vector>
using namespace std;
int maxConsecutiveOnes(string s) {
int maxCount = 0, count = 0;
for (char c : s) {
if (c == '1') {
count++;
} else {
maxCount = max(maxCount, count);
count = 0;
}
}
return max(maxCount, count);
}
int main() {
int T;
cin >> T;
while (T--) {
int N;
cin >> N;
string S;
cin >> S;
int result = maxConsecutiveOnes(S);
cout << result << endl;
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1113 Fliping Game
- Contest
- Brain Booster #7
- Language
- C++11 (G++ 13.2.0)
- Submit At
- 2024-11-05 14:58:52
- Judged At
- 2024-11-05 14:58:52
- Judged By
- Score
- 5
- Total Time
- 40ms
- Peak Memory
- 540.0 KiB