제출 #410457

#제출 시각아이디문제언어결과실행 시간메모리
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;
}

컴파일 시 표준 에러 (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...