6 해설
-
1
#include <stdio.h> #define int long long int ksm(int a) { int b = 2; int ans = 1; while (a > 0) { if (a % 2 == 1) { ans = (b * ans) % 1000000; } b = (b * b) % 1000000; a /= 2; } ans = (ans - 1 + 1000000) % 1000000; return ans; } signed main() { int t; scanf("%lld", &t); while (t--) { int m; scanf("%lld", &m); int num = ksm(m); printf("%lld\n", num); } return 0; }
정보
- ID
- 156
- 시간
- 1000ms
- 메모리
- 128MiB
- 난이도
- 6
- 태그
- (N/A)
- 제출 기록
- 663
- 맞았습니다.
- 200
- 아이디