QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#529000#9229. Juliet Unifies OnesJowaire (Maoxuan Peng, Wanying He, Zongxin Liu)#WA 0ms3712kbC++20409b2024-08-24 08:10:282024-08-24 08:10:29

Judging History

This is the latest submission verdict.

  • [2024-08-24 08:10:29]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3712kb
  • [2024-08-24 08:10:28]
  • Submitted

answer

#include <bits/stdc++.h>
using namespace std;

const int N=55;
string S;
int n;

int main(){
  cin>>S;n=(int)S.size();
  int ans=n+1;

  for(int i=0;i<n;i++)
    for(int j=i;j<n;j++){
	  int res=0;
	  for(int k=0;k<i;k++) if(S[k]=='1') ++res;
	  for(int k=j+1;k<n;k++) if(S[k]=='1') ++res;
	  for(int k=i;k<=j;k++) if(S[k]=='0') ++res;
	  ans=min(ans,res);
	}
  cout<<ans;

  return 0;
}

詳細信息

Test #1:

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

input:

00011011001

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

11101111111111111101001011110111111110011101010110

output:

11

result:

ok 1 number(s): "11"

Test #3:

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

input:

00000000100000000000100000010001000

output:

3

result:

ok 1 number(s): "3"

Test #4:

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

input:

00000000000000000000000000000000000000000000000000

output:

1

result:

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