https://nanti.jisuanke.com/t/31716
答案就是2^(n-1)%mod ,n非常的大,由欧拉降幂公式 AB%C=AB%phi(C)+phi(C)%C 化简
2n-1%mod = 2(n-1)%(mod-1)+(mod-1)%mod
1 #include<bits/stdc++.h> 2 using namespace std; 3 #define LL long long 4 #define inf 0x3f3f3f3f 5 #define mp make_pair 6 #define pb push_back 7 #define pii pair<int,int> 8 LL mod=1000000007; 9 LL phi(LL n){ 10 LL ans=n; 11 for(LL i=2;i*i<=n;++i){ 12 if(n%i==0){ 13 ans=ans*(i-1)/i; 14 while(n%i==0)n/=i; 15 } 16 } 17 if(n>1) ans=ans*(n-1)/n; 18 return ans; 19 } 20 LL qpow(LL a,LL b,LL c){ 21 if(a==0) return a; 22 LL r=1; 23 while(b){ 24 if(b&1)r=r*a%c; 25 a=a*a%c; 26 b>>=1; 27 } 28 return r; 29 } 30 char n[100050]; 31 int main(){ 32 LL t; 33 scanf("%lld",&t); 34 while(t--){ 35 scanf("%s",n); 36 int len=strlen(n); 37 LL pc=mod-1,r=0; 38 for(int i=0;i<len;++i){ 39 r=(r*10+n[i]-'0')%pc; 40 } 41 r=(r-1+pc)%pc; 42 r+=pc; 43 printf("%lld ",qpow(2,r,mod)); 44 } 45 return 0; 46 }