답안 #581015

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
581015 2022-06-22T08:18:46 Z pakapu Rack (eJOI19_rack) C++14
100 / 100
31 ms 11296 KB
#include <iostream>
#include <vector>
#include <numeric>
#include <algorithm>
#include <queue>
#include <bitset>
#include <math.h>

using namespace std;

const int MOD = 1e9 + 7;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

    long long n, k;
    cin >> n >> k;

    string s = bitset<10000000>(k - 1).to_string();

    reverse(s.begin(), s.end());

    long long pos = 1;
    for(int i = 0; i < n; i++) {
        if(s[i] == '1') {
            pos = (pos * 2) % MOD;
        }
        else {
            pos = (pos * 2 - 1) % MOD;
        }
    }

    cout << pos;


    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 11220 KB Output is correct
2 Correct 22 ms 11220 KB Output is correct
3 Correct 31 ms 11220 KB Output is correct
4 Correct 29 ms 11220 KB Output is correct
5 Correct 25 ms 11220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 11220 KB Output is correct
2 Correct 22 ms 11220 KB Output is correct
3 Correct 31 ms 11220 KB Output is correct
4 Correct 29 ms 11220 KB Output is correct
5 Correct 25 ms 11220 KB Output is correct
6 Correct 22 ms 11220 KB Output is correct
7 Correct 22 ms 11220 KB Output is correct
8 Correct 22 ms 11220 KB Output is correct
9 Correct 23 ms 11220 KB Output is correct
10 Correct 27 ms 11220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 11220 KB Output is correct
2 Correct 22 ms 11220 KB Output is correct
3 Correct 31 ms 11220 KB Output is correct
4 Correct 29 ms 11220 KB Output is correct
5 Correct 25 ms 11220 KB Output is correct
6 Correct 22 ms 11220 KB Output is correct
7 Correct 22 ms 11220 KB Output is correct
8 Correct 22 ms 11220 KB Output is correct
9 Correct 23 ms 11220 KB Output is correct
10 Correct 27 ms 11220 KB Output is correct
11 Correct 22 ms 11296 KB Output is correct
12 Correct 22 ms 11220 KB Output is correct
13 Correct 25 ms 11220 KB Output is correct
14 Correct 23 ms 11220 KB Output is correct
15 Correct 28 ms 11220 KB Output is correct