QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#446993#6976. Hanging RackRaduM100 ✓0ms3704kbC++20589b2024-06-17 19:45:022024-06-17 19:45:02

Judging History

你现在查看的是最新测评结果

  • [2024-06-17 19:45:02]
  • 评测
  • 测评结果:100
  • 用时:0ms
  • 内存:3704kb
  • [2024-06-17 19:45:02]
  • 提交

answer

#include <bits/stdc++.h>
#define mod 1000000007
using namespace std;
int exp(int b, int e){
    int rez = 1;
    while(e){
        if(e & 1) rez = (1LL * rez * b) % mod;
        e >>= 1;
        b = (1LL * b * b) % mod;
    }
    return rez;
}
int main()
{
    int n,t,i,rez = 0;
    long long k;
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n;
    cin >> k;
    k--;
    for(i = 0; (1LL << i) <= k; i++){
        if(k & (1LL << i))
            rez = (rez + exp(2, n - i - 1)) % mod;
    }
    cout << (rez + 1) % mod;
    return 0;
}

详细

Subtask #1:

score: 20
Accepted

Test #1:

score: 20
Accepted
time: 0ms
memory: 3628kb

input:

3 2

output:

5

result:

ok 1 number(s): "5"

Test #2:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

5 6

output:

21

result:

ok 1 number(s): "21"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

6 31

output:

31

result:

ok 1 number(s): "31"

Test #4:

score: 0
Accepted
time: 0ms
memory: 3516kb

input:

7 65

output:

2

result:

ok 1 number(s): "2"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3704kb

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: 3700kb

input:

11 176

output:

1961

result:

ok 1 number(s): "1961"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

13 3466

output:

4663

result:

ok 1 number(s): "4663"

Test #8:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

16 56635

output:

23740

result:

ok 1 number(s): "23740"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

18 162196

output:

206458

result:

ok 1 number(s): "206458"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3580kb

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: 3704kb

input:

42 565922676

output:

203957466

result:

ok 1 number(s): "203957466"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3572kb

input:

753 96292338983

output:

52198484

result:

ok 1 number(s): "52198484"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3700kb

input:

5618 4404252245114

output:

321125853

result:

ok 1 number(s): "321125853"

Test #14:

score: 0
Accepted
time: 0ms
memory: 3632kb

input:

57219 820772271145438

output:

490820056

result:

ok 1 number(s): "490820056"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3696kb

input:

973456 734872554128713318

output:

751564994

result:

ok 1 number(s): "751564994"