ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1071. Nikifor 2

mistaken Who can help me! [10] // Problem 1071. Nikifor 2 14 Sep 2003 06:51
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.
ACer Re: some hint [9] // Problem 1071. Nikifor 2 15 Sep 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
mistaken Re: some hint // Problem 1071. Nikifor 2 17 Sep 2003 14:01
> 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
mistaken Re: some hint // Problem 1071. Nikifor 2 17 Sep 2003 14:04
Think you! But I test my program is WA! Can you post your program for
me?
&#181;&#1066;1223
mistaken Re: some hint [6] // Problem 1071. Nikifor 2 17 Sep 2003 14:07
I can tell you what does 1223 means in chinese, but you must tell me
you Email!
ACer Re:My Ac problem. [5] // Problem 1071. Nikifor 2 17 Sep 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.
mistaken Thank you // Problem 1071. Nikifor 2 18 Sep 2003 09:50
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!
mistaken Will Send Information! // Problem 1071. Nikifor 2 18 Sep 2003 09:52
I have a some matter,I'll send you later,Maybe this afternoon!
mistaken Will Send Information! [2] // Problem 1071. Nikifor 2 18 Sep 2003 09:52
I have a some matter,I'll send you later,Maybe this afternoon!
mistaken I'll tell you what do I think! // Problem 1071. Nikifor 2 19 Sep 2003 09:42
I'll tell you what do I think,please wait!