QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#530334 | #9229. Juliet Unifies Ones | ucup-team3659# | WA | 1ms | 3956kb | C++14 | 435b | 2024-08-24 16:06:35 | 2024-08-24 16:06:37 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
int n;
char s[52];
int main(){
scanf("%s",s+1),n=strlen(s+1);
int answer=n;
for(int i=1;i<=n;i++)
for(int j=i;j<=n;j++){
int cnt=0;
for(int k=1;k<=n;k++)
if(i<=k&&k<=j)cnt+=s[k]=='0';
else cnt+=s[k]=='1';
answer=min(answer,cnt);
}
printf("%d\n",answer);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3956kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3920kb
input:
11101111111111111101001011110111111110011101010110
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 1ms
memory: 3768kb
input:
00000000100000000000100000010001000
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: -100
Wrong Answer
time: 1ms
memory: 3948kb
input:
00000000000000000000000000000000000000000000000000
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'