QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#62344 | #4592. Theramore | qinjianbin# | AC ✓ | 17ms | 3644kb | C++17 | 516b | 2022-11-18 12:12:10 | 2022-11-18 12:12:11 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int T;
char str[MAXN];
int cnt[2][2];
int main() {
scanf("%d", &T);
while (T--) {
scanf("%s", str);
int len = strlen(str);
memset(cnt, 0, sizeof cnt);
for (int i = 0; i < len; i++)
cnt[i % 2][str[i] - '0']++;
for (int i = 0; i < len; i++) {
if (cnt[i % 2][0]) {
putchar('0');
cnt[i % 2][0]--;
}
else {
putchar('1');
cnt[i % 2][1]--;
}
}
puts("");
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 17ms
memory: 3644kb
input:
10 101001 01101100000000101010 11100100010110110011101010011111111010110100011100000001101011111001101000001010101001101101010011100101001000001011111011010001111110100101100010111110011000000101110110110001010100110001000110001101110011001101101101011000011010011010101111010010111010001001010111111...
output:
001011 00000000001010101111 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
ok 10 lines