Modular Exponentiation 2 by 51b

import std.stdio;void main(){for(long a,b,c,k;~scanf("%d%d%d",&a,&b,&c);printf("%d
",k))for(k=1;b;b/=2)b%2?k=k*a%c:0,a=a*a%c;}

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page