标签:des style blog http color io os ar java
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
1 #include<set> 2 #include<queue> 3 #include<vector> 4 #include<cstdio> 5 #include<cstdlib> 6 #include<cstring> 7 #include<iostream> 8 #include<algorithm> 9 using namespace std; 10 const int Mod = 29; 11 #define Rep(i,n) for(int i=1;i<=n;i++) 12 #define For(i,l,r) for(int i=l;i<=r;i++) 13 14 int ans,x; 15 16 int quickpow(int m,int n){ 17 int ans=1; 18 while(n){ 19 if(n&1) ans=(ans*m)%Mod; 20 m=(m*m)%Mod; 21 n>>=1; 22 } 23 return ans%Mod; 24 } 25 26 int main(){ 27 while(scanf("%d",&x),x){ 28 int ans=0; 29 ans=(quickpow(2,2*x+1)-1)%Mod; 30 ans=ans%Mod*(quickpow(3,x+1)-1)*15%Mod; 31 ans=ans%Mod*(quickpow(22,x+1)-1)*18%Mod; 32 printf("%d\n",ans%Mod); 33 } 34 return 0; 35 }
标签:des style blog http color io os ar java
原文地址:http://www.cnblogs.com/kingnight/p/4020959.html