Created
December 15, 2025 04:54
-
-
Save hikariyo/ada5be7f2e2b294f6ad651ac7793fa3d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // #include <bits/stdc++.h> | |
| #include <iostream> | |
| using namespace std; | |
| const int P = 10007; | |
| int qpow(int a, int k) { | |
| int res = 1; | |
| while (k) { | |
| if (k & 1) res = res * a % P; | |
| a = a * a % P; | |
| k >>= 1; | |
| } | |
| return res; | |
| } | |
| int solve() { | |
| int n; | |
| cin >> n; | |
| return (qpow(2, n+1) + qpow(4, n)) % P * qpow(4, P-2) % P; | |
| } | |
| signed main() { | |
| ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); | |
| int T; | |
| cin >> T; | |
| while (T--) cout << solve() << '\n'; | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment