提交时间:2025-05-11 13:48:47
运行 ID: 37789
#include<bits/stdc++.h> #define int long long using namespace std; const int mod=1e9+7; void testread(){freopen("test.in","r",stdin);freopen("test.out","w",stdout);} void fastios(){ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);} void realread(){freopen("future.in","r",stdin);freopen("future.out","w",stdout);} map<int,int>mp; int quick_pow(int x){ if(x==0){mp[x]=1;return 1;} if(x%2==1){mp[x]=(((quick_pow(x/2)*quick_pow(x/2))%mod)*2)%mod;} else{mp[x]=((quick_pow(x/2)*quick_pow(x/2))%mod);} } signed main(){ fastios(); //testread(); realread(); int t; cin>>t; while(t--){ int n; cin>>n; mp.clear(); cout<<(quick_pow(n)-n%mod-1+mod)%mod<<endl; } return 0; }