문제
풀이
#include <iostream>
#define MOD 1000000007
using namespace std;
long long power(long long base, long long exp) {
long long ret = 1;
while (exp) {
if (exp & 1) ret = ret * base % MOD;
base = base * base % MOD;
exp >>= 1;
}
return ret;
}
void solve(void) {
int n; cin >> n;
cout << (n == 1 ? 1 : power(2, n-2)) << "\n";
}
int main(void) {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t; cin >> t;
while (t--) solve();
return 0;
}