QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#529193 | #9229. Juliet Unifies Ones | ucup-team3699# | WA | 0ms | 3816kb | C++20 | 649b | 2024-08-24 10:24:30 | 2024-08-24 10:24:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define F first
#define S second
const int mol=998244353;
void solve(){
string a;
cin>>a;
int to=0;
for(auto t: a) to+=(t=='1');
int ans=1e18;
for(int i=0;i<a.size();i++){
int t1=0, t0=0;
for(int j=i;j<a.size();j++){
if(a[j]=='0') t0++;
else t1++;
ans=min(ans, t0+to-t1);
}
}
cout<<ans<<"\n";
}
signed main(){
ios::sync_with_stdio(0);cin.tie(0);
// int t;
// cin>>t;
// while(t--)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3788kb
input:
00011011001
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
11101111111111111101001011110111111110011101010110
output:
11
result:
ok 1 number(s): "11"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3816kb
input:
00000000100000000000100000010001000
output:
3
result:
ok 1 number(s): "3"
Test #4:
score: -100
Wrong Answer
time: 0ms
memory: 3556kb
input:
00000000000000000000000000000000000000000000000000
output:
1
result:
wrong answer 1st numbers differ - expected: '0', found: '1'