제출 #841807

#제출 시각아이디문제언어결과실행 시간메모리
841807peraRack (eJOI19_rack)C++17
100 / 100
1 ms548 KiB
#include <bits/stdc++.h>
using namespace std;

#define int long long

const int mod = 1e9 + 7;

int exp(int x , int y){
    int r = 1;
    x %= mod;
    while(y){
        if(y & 1) r = r * x % mod;
        x = x * x % mod;
        y /= 2;
    }
    return r;
}

main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n , k;cin >> n >> k;
    int ans = 0;
    for(int i = 0;i < n;i ++){
        if((1LL << i) >= k) break;
        if((1LL << i) & (k - 1)){
            ans = (ans + exp(2 , n - i - 1)) % mod;
        }
    }
    cout << (ans + 1) % mod << endl;
}

컴파일 시 표준 에러 (stderr) 메시지

rack.cpp:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main() {
      | ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...