답안 #1077786

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1077786 2024-08-27T09:08:55 Z raduv Rack (eJOI19_rack) C++17
100 / 100
5 ms 436 KB
#include <bits/stdc++.h>
const int MOD = 1'000'000'007;

int main()
{
    int n, i;
    long long k, ans;
    scanf("%d%lld", &n, &k);
    ans = 0;
    k--;
    for( i = 0; i < n; i++ ){
      ans = (ans * 2 + k % 2) % MOD;
      k /= 2;
    }
    printf("%d\n", (ans + 1) % MOD);
    return 0;
}

Compilation message

rack.cpp: In function 'int main()':
rack.cpp:15:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
   15 |     printf("%d\n", (ans + 1) % MOD);
      |             ~^     ~~~~~~~~~~~~~~~
      |              |               |
      |              int             long long int
      |             %lld
rack.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d%lld", &n, &k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 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 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 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 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 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 436 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 5 ms 348 KB Output is correct