提交时间:2025-05-11 14:10:38

运行 ID: 37814

#include<bits/stdc++.h> using namespace std; const int md = 1e9+7; int T; long long n; long long ans; long long quickpow(long long x,long long y){ long long tmp=1; while(y){ if(y&1) tmp=(tmp%md*x%md)%md; y=y>>1; x=x%md*x%md; } return tmp; } signed main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin>>T; while(T--){ scanf("%lld",&n); ans=0; ans=(quickpow(2,n)%md-2%md-(n-1)%md+md)%md; printf("%lld\n",ans); } return 0; }