QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#756559#9565. Birthday Giftveg#WA 0ms3848kbC++14426b2024-11-16 20:57:042024-11-16 20:57:07

Judging History

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

  • [2024-11-16 20:57:07]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3848kb
  • [2024-11-16 20:57:04]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
char s[500005];
int main() {
	int T;
	cin >> T;
	while (T--) {
		int n,a=0,b=0,c=0;
		scanf("%s", s + 1);
		n = strlen(s + 1);
		for (int i = 2; i <= n; i += 2)
			if (s[i] != '2')
			s[i] = '0' + '1' - s[i];
		for (int i = 1; i <= n; ++i)
			if (s[i] == '0') ++a;
			else if (s[i] == '1') ++b;
			else ++c;
		printf("%d\n", max(abs(a-b)-c,1));
	}
	return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3848kb

input:

5
0110101
01020102
0000021111
1012121010
0100202010

output:

3
4
1
6
1

result:

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