QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#558101 | #9229. Juliet Unifies Ones | ucup-team4074# | WA | 1ms | 3636kb | C++20 | 816b | 2024-09-11 14:10:53 | 2024-09-11 14:10:53 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define fast ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
using namespace std;
void solve();
signed main(){
fast
int t = 1;
// cin >> t;
while(t--) solve();
}
const int N = 100;
int n;
char s[N];
void solve(){
cin >> s;
n = strlen(s);
int res = 2e9;
for(int i = 0; i < n; i++){
for(int j = i; j < n; j++){
int cnt = 0;
for(int l = 0; l < i; l++){
cnt += s[l] == '1';
}
for(int r = j + 1; r < n; r++){
cnt += s[r] == '1';
}
for(int l = i; l <= j; l++){
cnt += s[l] == '0';
}
res = min(res, cnt);
}
}
cout << res << '\n';
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3636kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 1ms
memory: 3544kb
input:
11101111111111111101001011110111111110011101010110
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3468kb
input:
00000000100000000000100000010001000
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3532kb
input:
00000000000000000000000000000000000000000000000000
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'