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

Who can help me!
Posted by mistaken 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.
Re: some hint
Posted by ACer 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
Re: some hint
Posted by mistaken 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
Re: some hint
Posted by mistaken 17 Sep 2003 14:04
Think you! But I test my program is WA! Can you post your program for
me?
&#181;&#1066;1223
Re: some hint
Posted by mistaken 17 Sep 2003 14:07
I can tell you what does 1223 means in chinese, but you must tell me
you Email!
Re:My Ac problem.
Posted by ACer 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.
Thank you
Posted by mistaken 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!
Will Send Information!
Posted by mistaken 18 Sep 2003 09:52
I have a some matter,I'll send you later,Maybe this afternoon!
Will Send Information!
Posted by mistaken 18 Sep 2003 09:52
I have a some matter,I'll send you later,Maybe this afternoon!
Re: thank you.but I'm not really understand the problem
Posted by ACer 18 Sep 2003 20:59
I'll tell you what do I think!
Posted by mistaken 19 Sep 2003 09:42
I'll tell you what do I think,please wait!