Submission #1077786

#TimeUsernameProblemLanguageResultExecution timeMemory
1077786raduvRack (eJOI19_rack)C++17
100 / 100
5 ms436 KiB
#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 (stderr)

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);
      |     ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...