답안 #637515

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
637515 2022-09-02T11:06:49 Z ksu2009en Rack (eJOI19_rack) C++17
100 / 100
9 ms 7924 KB
#include <iostream>
#include <vector>
#include <string>
#include <math.h>
#include <cmath>
#include <iomanip>
#include <cstdio>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <deque>
#include <bitset>
#include <cstring>

using namespace std;
typedef long long ll;

ll power[1000007];

int main(){
    ll n, k;
    cin >> n >> k;
    
    power[0] = 1;
    
    for(int i = 1; i <= n; i++)
        power[i] = (power[i - 1] * 2) % (ll)(1e9 + 7 );
    
    ll add = n-1;
    ll ans = 0, step = n-1;
    
    while(step > 0){
        if(k % 2 == 0){
            ans += power[add];
            ans %= (ll)(1e9 + 7);
        }
        
        k = (k + 1) / 2;
        step--;
        add--;
    }
    ans += k;
    
    cout << ans << endl;
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 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 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 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 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 340 KB Output is correct
14 Correct 1 ms 724 KB Output is correct
15 Correct 9 ms 7924 KB Output is correct