QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#529193#9229. Juliet Unifies Onesucup-team3699#WA 0ms3816kbC++20649b2024-08-24 10:24:302024-08-24 10:24:30

Judging History

你现在查看的是最新测评结果

  • [2024-08-24 10:24:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3816kb
  • [2024-08-24 10:24:30]
  • 提交

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'