a7n007's blog

By a7n007, history, 3 years ago, In English

int pow(int a,int b,int m){ cout<<a<<b<<endl; if(b == 1) return a % m; if(b % 2 == 0){ int t = pow(a,b/2,m); return (1ll * t * t % m); } else{ int t = pow(a,(b-1)/2,m); t = (1ll * t * t % m); return (1ll * a * t % m); } }

JUST Works

  • Vote: I like it
  • -28
  • Vote: I do not like it

| Write comment?