|
|
вернуться в форумHelp me!!!!!!!! why 6 test wrong answer???????? program de; var a,n,i,r,x,y,step,j:longint; q:boolean; s1,s2,s:string; begin step:=1; q:=false; read(x); read(y); repeat s1:=''; s2:=''; n:=x; inc(step); repeat i:=n mod step; n:=n div step; str(i,s); s1:=s+s1; until n=0; r:=y; repeat i:=r mod step; r:=r div step; str(i,s); s2:=s+s2; until r=0; j:=1; for i:=1 to length(s1) do if (s1[i]=s2[j]) and (j<>length(s2)+1) then inc(j); if j=length(s2)+1 then q:=true; until (step=x+1) or q; if q then writeln(step) else writeln('No solution'); end. |
|
|