int quickpow(int x,int n,int p){ //o(logn) //x的n次方mod p int res=1; while(n){ if(n&1) res=res*x%p; x=x*x%p; n=n>>1; } return res; }