QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#756559 | #9565. Birthday Gift | veg# | WA | 0ms | 3848kb | C++14 | 426b | 2024-11-16 20:57:04 | 2024-11-16 20:57:07 |
Judging History
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;
}
Details
Tip: Click on the bar to expand more detailed information
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'