QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#756084 | #9565. Birthday Gift | L_wwqq | WA | 0ms | 3576kb | C++20 | 781b | 2024-11-16 18:59:17 | 2024-11-16 18:59:17 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define i128 __int128
#define fi first
#define se second
#define all(a) begin(a)+1,end(a)
typedef unsigned long long ull;
using namespace std;
using pii = pair<int,int>;
using piii = pair<int,pii>;
const int N = 1e6+5;
int n,m,k;
inline void beez(){
string s;
cin >> s;
int n0 = 0,n1 = 0,n2 = 0;
bool ok = true;
for(auto it : s){
if(it == '2') n2 ++;
else if(it == '0' and ok) n0 ++;
else n1 ++;
ok = !ok;
}
int tmp = abs(n0 - n1);
if(tmp > n2) cout << tmp - n2 << "\n";
else {
tmp -= n2;
if(tmp & 1) cout << "1\n";
else cout << "0\n";
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int __=1;
cin>>__;
while(__--){
beez();
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3576kb
input:
5 0110101 01020102 0000021111 1012121010 0100202010
output:
5 0 2 6 2
result:
wrong answer 1st numbers differ - expected: '3', found: '5'