제출 #1075768

#제출 시각아이디문제언어결과실행 시간메모리
1075768matthewRack (eJOI19_rack)C++17
40 / 100
1 ms348 KiB
#include <stdio.h> const int MOD = 1'000'000'007; int lgput(int a, int b) { int res = 1; while(b > 0) { if(b & 1) { res = (res * (long long)a) % MOD; } a = (a * (long long)a) % MOD; b /= 2; } return res; } int main() { #ifdef LOCAL freopen("input.txt", "r", stdin); #endif int n, i, res; long long k; scanf("%d%lld", &n, &k); k--; res = 0; for(i = 0; i < n; i++) { if((k >> i) & 1) { res = (res + lgput(2, n - 1 - i)) % MOD; } } printf("%d\n", res + 1); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

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