您的位置:首页 > 其它

hdu 5363 Key Set(水)

2015-08-07 19:23 274 查看
题目链接:hdu 5363 Key Set

#include <cstdio>
#include <cstring>
#include <algorithm>

using namespace std;
const int mod = 1000000007;

int pow_mod (long long x, int n) {
long long ans = 1;
while (n) {
if(n&1)
ans = ans * x % mod;
x = x * x % mod;
n >>= 1;
}
return ans;
}

int main () {
int cas, n;
scanf("%d", &cas);
while (cas--) {
scanf("%d", &n);
printf("%d\n", (pow_mod(2, n-1) + mod - 1) % mod);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: