标签:c style class blog code java
快速幂水过,贴一下模版。
const mo=100003; var x,y,n,m:int64; function power(num,times:int64):int64; var temp:int64; begin if times=1 then exit(num); temp:=power(num,times>>1); power:=(temp*temp) mod mo; if times and 1=1 then power:=(power*num) mod mo; end; procedure main; begin readln(m,n); x:=power(m,n); y:=power(m-1,n-1); y:=(y*m) mod mo; writeln((x-y+mo) mod mo); end; begin main; end.
HNOI2008越狱(快速幂),布布扣,bubuko.com
标签:c style class blog code java
原文地址:http://www.cnblogs.com/zyfzyf/p/3763098.html