답안 #844640

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
844640 2023-09-05T15:15:54 Z EntityPlantt Rack (eJOI19_rack) C++14
100 / 100
2 ms 600 KB
#include <cstdio>
#define int long long
const int mod = 1000000007;
int n, k, i, r = 1;
int pow2(int x) {
    if (!x) return 1;
    if (x & 1) return 2 * pow2(x / 2) % mod * pow2(x / 2) % mod;
    return pow2(x / 2) * pow2(x / 2) % mod;
}
signed main() {
    scanf("%lld%lld", &n, &k);
    for (i = n - 1; i >= 0; i--) {
        if (k & 1) k++;
        else r = (r + pow2(i)) % mod;
        k = (k + 1) / 2;
    }
    printf("%lld", r);
    return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%lld%lld", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 600 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 600 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 2 ms 344 KB Output is correct