215错误
查看原帖
215错误
2674
「QQ红包」发红包了楼主2015/4/8 13:11

为什么……

[codep]

 var b,p,m,s,t:longint;
 begin
     read(b,p,m);
     write(b,'^',p,' mod ',m,'=');
     s:=1;t:=b;
     while p>0 do
     begin
          if p mod 2=1 then s:=s*t mod m;
          p:= p div 2;
          t:=t*t mod m;
     end;
     write(s);
end.
[/codep]
2015/4/8 13:11
加载中...