QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#752017 | #9565. Birthday Gift | syhyyds | WA | 0ms | 3844kb | C++17 | 1.2kb | 2024-11-15 21:36:46 | 2024-11-15 21:36:52 |
Judging History
answer
#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <string>
#include <cstring>
#include <cmath>
#include <ctime>
#include <algorithm>
#include <utility>
#include <stack>
#include <queue>
#include <vector>
#include <set>
#include <math.h>
#include <map>
#include <sstream>
#include <deque>
#include <unordered_map>
#include <unordered_set>
#include <bitset>
#include <stdio.h>
#include <iostream>
#include <vector>
#include <queue>
#include <array>
#include <climits>
using namespace std;
#define LL long long
#define ls o<<1
#define rs o<<1|1
#define PII pair<int,int>
#define PPI pair<pair<int,int>,int >
const int N =2e5+100;
const LL mod = 998244353;
const LL MAX=1e18;
char s[N];
int a[4];
void solve()
{
scanf("%s", s + 1);
int len = strlen(s + 1);
a[0] = a[1] = a[2] = 0;
for (int i = 1; i <= len; i++)
{
int x = s[i] - '0';
if (i % 2)
a[x]++;
else
{
if (x == 2) a[2]++;
else
{
x = x ^ 1;
a[x]++;
}
}
}
int ans = abs(a[1] - a[0]) - a[2];
if (ans< 0) ans = (-ans) % 2;
printf("%d", ans);
}
int main()
{
int T;
scanf("%d", &T);
while (T--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3844kb
input:
5 0110101 01020102 0000021111 1012121010 0100202010
output:
34060
result:
wrong answer 1st numbers differ - expected: '3', found: '34060'