QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#533672 | #9229. Juliet Unifies Ones | Ycfhnnd | WA | 0ms | 3544kb | C++23 | 687b | 2024-08-26 10:19:56 | 2024-08-26 10:19:57 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
string s;
cin >> s;
int n = s.size();
int l = n, r = 0;
for (int i = 0;i < n;i ++){
if (s[i] == '1'){
l = min(l, i);
r = i;
}
}
if (l == n){
cout << 0;
}else{
int cnt = 0, ans = 0;
for (int i = l;i <= r;i ++){
if (s[i] == '0'){
cnt ++;
}else{
if (cnt) ans ++;
cnt = 0;
}
}
cout << ans;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3520kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3544kb
input:
11101111111111111101001011110111111110011101010110
output:
9
result:
wrong answer 1st numbers differ - expected: '11', found: '9'