ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#202114 | #2784. 01串 | wosile | 100 | 180ms | 1516kb | C++11 | 600b | 2024-02-12 10:15:18 | 2024-02-12 18:49:06 |
answer
#include<bits/stdc++.h>
using namespace std;
#define N 45000
int f[N+5],b[N+5];
int main(){
int T;
scanf("%d",&T);
for(int i=1;i<=N;i++)f[i]=i*(i+1)/2;
while(T--){
int n;
scanf("%d",&n);
int len=lower_bound(f+1,f+N+1,n)-f;
int r=f[len]-n;
int pos=0;
for(int i=1;i<=len;i++)b[i]=1;
for(int i=N;i>=1;i--){
while(r>=f[i]){
r-=f[i];
for(int j=0;j<i;j++)b[++pos]=0;
b[++pos]=1;
}
}
putchar(48);
int tmp=0;
for(int i=1;i<=len;i++){
tmp^=b[i];
putchar(tmp+48);
}
putchar(10);
}
return 0;
//quod erat demonstrandum
}
Details
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 8
Accepted
Test #1:
score: 8
Accepted
time: 13ms
memory: 1348kb
input:
500 13 7 6 20 1 18 17 19 9 15 10 12 9 8 11 15 3 14 7 9 7 17 16 19 18 7 11 14 6 5 17 3 11 7 2 20 7 7 ...
output:
001101 00010 0101 0010101 01 0001010 0001101 0011010 00101 010101 01010 000101 00101 00110 000110 01...
result:
points 1.0 Accepted
Subtask #2:
score: 21
Accepted
Test #2:
score: 21
Accepted
time: 17ms
memory: 1352kb
input:
500 933 647 306 780 621 898 757 879 89 95 790 72 469 828 171 515 623 934 687 589 147 417 816 939 758...
output:
00000111010101010101010101010101010101010101 0000001110010101010101010101010101010 00000011100101010...
result:
points 1.0 Accepted
Subtask #3:
score: 23
Accepted
Test #3:
score: 23
Accepted
time: 18ms
memory: 1352kb
input:
500 84933 1647 40306 72780 90621 15898 73757 86879 66089 93095 5790 43072 69469 44828 60171 14515 68...
output:
0000000000000000011110001010101010101010101010101010101010101010101010101010101010101010101010101010...
result:
points 1.0 Accepted
Subtask #4:
score: 48
Accepted
Test #4:
score: 48
Accepted
time: 132ms
memory: 1516kb
input:
500 253484933 463401647 466040306 780172780 189090621 382815898 292073757 119686879 18566089 2984930...
output:
0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000...
result:
points 1.0 Accepted
Extra Test:
score: 0
Extra Test Passed