| ||||||||||
Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
在网上找了CTU的数据过了,为什么在这测评会WA贴下代码 var a,b,c,k,t,now,c1,x,y:int64; flag:boolean; function gcd(a,b:int64):int64; var n,m:longint; begin if b=0 then begin x:=1;y:=0;exit(a);end; gcd:=gcd(b,a mod b); n:=x;m:=y; x:=m;y:=n-a div b*m; end; procedure main; begin readln(a,b,c,k); if k=0 then begin flag:=false;exit;end; t:=1<<(k-1);t:=t<<1; now:=gcd(c,t); if (b-a) mod now<>0 then writeln('FOREVER') else begin c1:=(b-a) div now;t:=t div now; x:=(x*c1 mod t+t) mod t; writeln(x); end; end; begin flag:=true; while flag do main; end. 求修正,谢谢! Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator