long exp_mod(long a,long n,long b) //a为底数,n为幂数,b为余数{ long t; if(n==0) return 1%b; if(n==1) return a%b; t=exp_mod(a,n/2,b); t=t*t%b; if((n&1)==1) t=t*a%b; return t;}