QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#183735 | #7115. Can You Guess My Sequence? | liuzhenhao09# | AC ✓ | 0ms | 4096kb | C++14 | 538b | 2023-09-19 19:47:48 | 2023-09-19 19:47:50 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
string s;
cin>>s;
if(s[0] == 'A'){
int n;
scanf("%lld",&n);
int x = 0;
for(int i = 1,v; i <= n; i++) scanf("%lld",&v),x += (1LL << v);
printf("%lld\n",x);
fflush(stdout);
}
else{
int x;
scanf("%lld",&x);
int n = 0;
int a[30];
for(int i = 0; i < 20; i++){
if((x >> i) & 1LL) a[++n] = i;
}
printf("%lld\n",n);
for(int i = 1; i <= n; i++) printf("%lld ",a[i]);
fflush(stdout);
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 4080kb
First Run Input
Alice 6 2 3 5 8 10 15
First Run Output
34092
Second Run Input
Bob 34092
Second Run Output
6 2 3 5 8 10 15
result:
ok correct
Test #2:
score: 100
Accepted
time: 0ms
memory: 4096kb
First Run Input
Alice 20 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
First Run Output
1048575
Second Run Input
Bob 1048575
Second Run Output
20 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
result:
ok correct
Test #3:
score: 100
Accepted
time: 0ms
memory: 3844kb
First Run Input
Alice 1 0
First Run Output
1
Second Run Input
Bob 1
Second Run Output
1 0
result:
ok correct
Test #4:
score: 100
Accepted
time: 0ms
memory: 4084kb
First Run Input
Alice 2 0 15
First Run Output
32769
Second Run Input
Bob 32769
Second Run Output
2 0 15
result:
ok correct
Test #5:
score: 100
Accepted
time: 0ms
memory: 3812kb
First Run Input
Alice 10 1 3 5 7 9 11 12 14 15 16
First Run Output
121514
Second Run Input
Bob 121514
Second Run Output
10 1 3 5 7 9 11 12 14 15 16
result:
ok correct
Test #6:
score: 100
Accepted
time: 0ms
memory: 3800kb
First Run Input
Alice 3 16 17 18
First Run Output
458752
Second Run Input
Bob 458752
Second Run Output
3 16 17 18
result:
ok correct
Test #7:
score: 100
Accepted
time: 0ms
memory: 3800kb
First Run Input
Alice 18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19
First Run Output
655359
Second Run Input
Bob 655359
Second Run Output
18 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 19
result:
ok correct