제출 #1075796

#제출 시각아이디문제언어결과실행 시간메모리
1075796matthewRack (eJOI19_rack)C++17
100 / 100
1 ms604 KiB
#include <stdio.h> #include <algorithm> 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 < std::min(n, 61); i++) { if((k >> i) & 1) { res = (res + lgput(2, n - 1 - i)) % MOD; } } printf("%d\n", (res + 1) % MOD); return 0; }

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

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