제출 #439626

#제출 시각아이디문제언어결과실행 시간메모리
439626LucaIlieRack (eJOI19_rack)C11
100 / 100
8 ms4172 KiB
#include <stdio.h> #define MAX_N 1000000 #define MAX_LG 62 #define MOD 1000000007 int p2mod[MAX_N + 1]; long long p2[MAX_LG + 1]; int main() { int n, r, i; long long k; scanf( "%d%lld", &n, &k ); k--; p2[0] = 1; for ( i = 1; i <= MAX_LG; i++ ) p2[i] = p2[i - 1] * 2; p2mod[0] = 1; for ( i = 1; i <= MAX_N; i++ ) p2mod[i] = (p2mod[i - 1] * 2) % MOD; r = 0; for ( i = MAX_LG; i >= 0; i-- ) { if ( (k / p2[i]) % 2 == 1 ) r = (r + p2mod[n - 1 - i]) % MOD; } printf( "%d", r + 1 ); return 0; }

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

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