|
|
вернуться в форумWho can help me! Var X , Y , K : Longint; Procedure Init; Begin Readln ( X , Y); K:=1; End; Procedure Work; Var X1 , Y1 , Temp , Temp1 ,T : Longint; Begin Repeat Inc(K); X1 := X; Y1:= Y; Repeat Temp:=Y1 Mod K; Repeat Temp1:= X1 Mod K; X1 := X1 Div K; If Temp1=Temp Then Y1:=Y1 Div K; Until (Temp=Temp1)Or(X1<=Y1); Until (Y1=0)Or(X1<=Y1); Until (Y1=0)Or(K>X)Or(X1<=Y1); If K<=X Then Writeln(K) Else Writeln('No solution'); End; Begin Init; Work; End. Re: some hint Послано ACer 15 сен 2003 17:39 I don't found your mistake,but your method will got TL,if you read the problem and see discuss's test,you will found the method by the way,what does 1223 means in chinese Re: some hint > I don't found your mistake,but your method will got TL,if you read > the problem and see discuss's test,you will found the method > by the way,what does 1223 means in chinese Re: some hint Think you! But I test my program is WA! Can you post your program for me? µЪ1223 Re: some hint I can tell you what does 1223 means in chinese, but you must tell me you Email! Re:My Ac problem. Послано ACer 17 сен 2003 17:57 cyh412@163.com you should find common divisor of x and y var i,x,y:longint; function p:boolean; var a,b:array[1..80000]of longint; h,len,t,l,k,g,j:longint; sd:boolean; begin t:=x;l:=y; p:=false; j:=0; fillchar(a,sizeof(a),0); fillchar(b,sizeof(b),0); if t=0 then j:=1 else while t>0 do begin inc(j);a[j]:=t mod i;t:=t div i;end; len:=j; j:=0; if l=0 then j:=1 else while l>0 do begin inc(j);b[j]:=l mod i;l:=l div i;end; h:=len; for k:=j downto 1 do begin sd:=false; for g:=h downto 1 do if b[k]=a[g] then begin h:=g-1;sd:=true;break;end; if sd=false then exit; end; p:=true; end; begin readln(x,y); i:=2; repeat if x mod i=y mod i then if p then begin writeln(i);exit;end; inc(I); until i=x; if i=x then writeln('No solution') end. Thank you I found my error! ----The Last "Until (Y1=0)Or(K>X)Or(X1<=Y1)" must replace "Until (Y1=0)or(K>X)or(X1=Y1)"------ I have got AC! Will Send Information! I have a some matter,I'll send you later,Maybe this afternoon! Will Send Information! I have a some matter,I'll send you later,Maybe this afternoon! Re: thank you.but I'm not really understand the problem Послано ACer 18 сен 2003 20:59 I'll tell you what do I think! I'll tell you what do I think,please wait! |
|
|