QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#549301#9229. Juliet Unifies Onesgogo11#WA 0ms3532kbC++20835b2024-09-06 14:08:342024-09-06 14:08:35

Judging History

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

  • [2024-09-06 14:08:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3532kb
  • [2024-09-06 14:08:34]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
using pii=pair<int,int>;
constexpr int INF=0x3f3f3f3f;
constexpr int MXN=1e6+5;


void solve()
{
    string s;
    cin>>s;
    int n=s.size(),ans=INF;
    for(int l=0;l<n;l++)
    {
        for(int r=l;r<n;r++)
        {
            int cnt=0;
            for(int i=0;i<l;i++)
                if(s[i]=='1')
                    cnt++;
            for(int i=r+1;i<n;i++)
                if(s[i]=='1')
                    cnt++;
            for(int i=l;i<=r;i++)
                if(s[i]=='0')
                    cnt++;
            ans=min(ans,cnt);
        }
    }
    cout<<ans<<"\n";
}
int main()
{
    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
    int _=1;
    // cin>>_;
    while(_--)
        solve();
    return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 0ms
memory: 3532kb

input:

00011011001

output:

2

result:

ok 1 number(s): "2"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

11101111111111111101001011110111111110011101010110

output:

11

result:

ok 1 number(s): "11"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3480kb

input:

00000000100000000000100000010001000

output:

3

result:

ok 1 number(s): "3"

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3460kb

input:

00000000000000000000000000000000000000000000000000

output:

1

result:

wrong answer 1st numbers differ - expected: '0', found: '1'