QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#648360 | #9229. Juliet Unifies Ones | ucup-team963# | WA | 0ms | 3720kb | C++14 | 496b | 2024-10-17 18:37:07 | 2024-10-17 18:37:07 |
Judging History
answer
#include <bits/stdc++.h>
#define rep(i,a,b) for(int i=(a);i<=(b);++i)
using namespace std;
const int N = 100;
char str[N];
signed main() {
cin >> (str + 1);
int n = strlen(str + 1);
int ret = n;
rep(l,1,n) rep(r,l,n) {
int ans = 0;
rep(i,1,l-1) if(str[i] == '1') ++ ans;
rep(i,r+1,n) if(str[i] == '1') ++ ans;
rep(i,l,r) if(str[i] == '0') ++ ans;
ret = min(ret, ans);
}
cout << ret << endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3720kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
11101111111111111101001011110111111110011101010110
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3696kb
input:
00000000100000000000100000010001000
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3580kb
input:
00000000000000000000000000000000000000000000000000
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'