QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#637370 | #9229. Juliet Unifies Ones | ucup-team3646# | WA | 0ms | 3828kb | C++20 | 576b | 2024-10-13 12:26:05 | 2024-10-13 12:26:06 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
template<class T>
bool chmin(T &a, const T &b) {if (a > b) {a = b; return 1;} return 0;}
void solve() {
string S;
cin>>S;
ll N=S.size();
int an=N;
for(int i=0;i<N;i++){
for(int j=i;j<N;j++){
int res=0;
for(int k=0;k<N;k++){
if(i<=k&&k<=j){
if(S[k]=='0')res++;
}
else{
if(S[k]=='1')res++;
}
}
an=min(an,res);
}
}
cout<<an<<endl;
}
int main() {
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
11101111111111111101001011110111111110011101010110
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3544kb
input:
00000000100000000000100000010001000
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3612kb
input:
00000000000000000000000000000000000000000000000000
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'