답안 #970568

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
970568 2024-04-26T17:46:20 Z Ludissey Rack (eJOI19_rack) C++14
40 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#define int long long
#define sz(a) (int)a.size()
#define all(x) (x).begin(), (x).end()
using namespace std;

const int mod=1e9+7;
int MOD(int x){
    return ((x+mod)%mod);
}

int fast_pow(int x, int p){
    if(p==1) return x;
    if(p==0) return 1;
    if(p%2==0) return MOD(MOD(fast_pow(x,p/2))*MOD(fast_pow(x,p/2)));
    else return MOD(MOD(fast_pow(x,p-1))*x);
}

signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
    int n,k; cin >> n>>k;
    k--;
    int sum=1;
    for (int i = 1; i <= n; i++)
    {
        if(k&(1LL<<(i-1LL))) sum=MOD(sum+MOD(fast_pow(2LL, (n-i))));
    }
    cout << sum << "\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Incorrect 0 ms 348 KB Output isn't correct
13 Halted 0 ms 0 KB -