Submission #410457

#TimeUsernameProblemLanguageResultExecution timeMemory
410457radaiosm7Rack (eJOI19_rack)C++98
100 / 100
10 ms8120 KiB
#include <bits/stdc++.h> using namespace std; int n, i; long long k, pos; const long long MOD = 1000000007LL; long long po[1000005]; int main() { scanf("%d%lld", &n, &k); pos = 1LL; po[0] = 1LL; for (i=1; i < 1000005; ++i) { po[i] = (po[i-1]*2LL)%MOD; } for (i=n-1; i >= 0; --i) { if ((k&1LL)==0LL) { pos = (pos+po[i])%MOD; } k = (k+1LL)>>1LL; } printf("%lld\n", pos); return 0; }

Compilation message (stderr)

rack.cpp: In function 'int main()':
rack.cpp:10:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   10 |   scanf("%d%lld", &n, &k);
      |   ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...