QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#672637 | #6976. Hanging Rack | KiharaTouma | 100 ✓ | 5ms | 11424kb | C++14 | 483b | 2024-10-24 17:54:10 | 2024-10-24 17:54:10 |
Judging History
answer
//qoj6976
#include <bits/stdc++.h>
using namespace std;
int n;
const long long P = 1e9 + 7;
long long k, pw2[1000010];
int main(){
pw2[0] = 1;
scanf("%d%lld", &n, &k);
for(int i = 1; i <= n; ++ i){
pw2[i] = pw2[i-1] * 2 % P;
}
-- k;
long long ans = 0;
for(int i = 0; i < min(n, 62); ++ i){
if((k >> i) & 1){
ans += pw2[n-i-1];
}
}
++ ans;
printf("%lld\n", ans % P);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 20
Accepted
Test #1:
score: 20
Accepted
time: 0ms
memory: 3784kb
input:
3 2
output:
5
result:
ok 1 number(s): "5"
Test #2:
score: 20
Accepted
time: 0ms
memory: 3864kb
input:
5 6
output:
21
result:
ok 1 number(s): "21"
Test #3:
score: 20
Accepted
time: 0ms
memory: 3844kb
input:
6 31
output:
31
result:
ok 1 number(s): "31"
Test #4:
score: 20
Accepted
time: 0ms
memory: 3788kb
input:
7 65
output:
2
result:
ok 1 number(s): "2"
Test #5:
score: 20
Accepted
time: 0ms
memory: 3868kb
input:
9 284
output:
434
result:
ok 1 number(s): "434"
Subtask #2:
score: 20
Accepted
Dependency #1:
100%
Accepted
Test #6:
score: 20
Accepted
time: 0ms
memory: 3804kb
input:
11 176
output:
1961
result:
ok 1 number(s): "1961"
Test #7:
score: 20
Accepted
time: 0ms
memory: 3880kb
input:
13 3466
output:
4663
result:
ok 1 number(s): "4663"
Test #8:
score: 20
Accepted
time: 0ms
memory: 3932kb
input:
16 56635
output:
23740
result:
ok 1 number(s): "23740"
Test #9:
score: 20
Accepted
time: 0ms
memory: 3868kb
input:
18 162196
output:
206458
result:
ok 1 number(s): "206458"
Test #10:
score: 20
Accepted
time: 0ms
memory: 3804kb
input:
20 214181
output:
152109
result:
ok 1 number(s): "152109"
Subtask #3:
score: 60
Accepted
Dependency #1:
100%
Accepted
Dependency #2:
100%
Accepted
Test #11:
score: 60
Accepted
time: 0ms
memory: 3808kb
input:
42 565922676
output:
203957466
result:
ok 1 number(s): "203957466"
Test #12:
score: 60
Accepted
time: 0ms
memory: 3864kb
input:
753 96292338983
output:
52198484
result:
ok 1 number(s): "52198484"
Test #13:
score: 60
Accepted
time: 0ms
memory: 3972kb
input:
5618 4404252245114
output:
321125853
result:
ok 1 number(s): "321125853"
Test #14:
score: 60
Accepted
time: 1ms
memory: 4228kb
input:
57219 820772271145438
output:
490820056
result:
ok 1 number(s): "490820056"
Test #15:
score: 60
Accepted
time: 5ms
memory: 11424kb
input:
973456 734872554128713318
output:
751564994
result:
ok 1 number(s): "751564994"