Submission #280257

#TimeUsernameProblemLanguageResultExecution timeMemory
280257antontsiorvasRack (eJOI19_rack)C++14
100 / 100
6 ms416 KiB
#include <cstdio> int ans[1000005]; void f(int n, long long int coats){ if(n == 0 || coats == 1) return; if(coats%2) ans[n] = 1; else ans[n] = 2; return f(n-1,coats-coats/2); } int main(){ int N, MOD = 1000000007; long long int K, pos=1, jump=1; scanf("%d%lld",&N,&K); f(N,K); for(int i=1; i<=N; i++){ if(ans[i] == 2) pos += jump; pos %= MOD; jump %= MOD; jump *= 2; } printf("%lld",pos); }

Compilation message (stderr)

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