|
|
вернуться в форумWrong answer test(6) Why?Help me+++++ 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. Re: Wrong answer test(6) Why?Help me+++++ For test 11 10 Your program writes 11 My AC program writes 'No solution' Systems of calculation from 2 up to 16 or ..... Re: Systems of calculation from 2 up to 16 or ..... My AC program uses bases from 2 to 100000 How???? How to organize translation in other system of calculation, it is more 9 Re: How???? Part of my AC program: leny = lenx = 0; while (x > 0) ax[lenx++] = x % base, x /= base; while (y > 0) ay[leny++] = y % base, y /= base; x, y - decimal numbers base - system of calculation ax[], ay[] - x and y in new system lenx, leny - its lengths |
|
|