답안 #810892

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
810892 2023-08-06T17:11:22 Z AlphaMale06 Rack (eJOI19_rack) C++14
100 / 100
0 ms 280 KB
#include <bits/stdc++.h>

using namespace std;
#define int long long
const int mod = 1e9+7;

int bs(int pw){
    if(pw<=0)return 1;
    if(pw==1)return 2;
    int ans = bs(pw/2);
    ans*=ans;
    ans%=mod;
    if(pw&1)ans*=2;
    return ans%mod;
}

signed main()
{
    int n, k;
    cin >> n >> k;
    int ans=1;
    int cnt=1;
    k--;
    while(k>0){
        if(k&1){
            ans+=bs(n-cnt);
        }
        ans%=mod;
        cnt++;
        k/=2;
    }
    cout << ans << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 280 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 280 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct