QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#538612#9229. Juliet Unifies OnesChinese_zjc_#WA 0ms3800kbC++20547b2024-08-31 12:39:162024-08-31 12:39:16

Judging History

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

  • [2024-08-31 12:39:16]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3800kb
  • [2024-08-31 12:39:16]
  • 提交

answer

#include <iostream>
#include <cstdio>
#include <cstring>
using namespace std;
int n;
char s[105];
int main(){
    scanf("%s",s+1);
    n=strlen(s+1);
    int ans=n;
    for (int l=1;l<=n;l++)
        for (int r=l;r<=n;r++){
            int c=0;
            for (int i=1;i<=n;i++)
                if (i>=l&&i<=r){
                    if (s[i]=='0')c++;
                }
                else{
                    if (s[i]=='1')c++;
                }
            ans=min(ans,c);
        }
    cout<<ans<<endl;
    return 0;
}

详细

Test #1:

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

input:

00011011001

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

11101111111111111101001011110111111110011101010110

output:

11

result:

ok 1 number(s): "11"

Test #3:

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

input:

00000000100000000000100000010001000

output:

3

result:

ok 1 number(s): "3"

Test #4:

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

input:

00000000000000000000000000000000000000000000000000

output:

1

result:

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