|
|
вернуться в форумwhat is test 3? I get wrong answer at test 3? why? this is my program: program gh; const x:array[1..4] of integer=(-1,0,1,0); y:array[1..4] of integer=(0,-1,0,1); var a,d,f,g,h,j,k,i,l,m,n:longint; s,z,c:string; procedure work(q:integer); var i,j,k,l:longint; v:string; begin if q=17 then begin if (pos('w',s)=0) and (g<m) then m:=g; end else begin v:=s; i:=((q-1) div 4)+1; j:=q-(i-1)*4; if s[q]='w' then s[q]:='b' else s[q]:='w'; for l:=1 to 4 do if (i+y[l]>0) and (i+y[l]<5) and (j+x[l]<5) and (j+x[l]>0) then if s[(i+y[l]-1)*4+j+x[l]]='w' then s[(i+y[l]-1)*4+j+x[l]]:='b' else s[(i+y[l]-1)*4+j+x[l]]:='w'; g:=g+1; work(q+1); g:=g-1; s:=v; work(q+1); end; end; begin s:=''; for i:=1 to 4 do begin readln(z); s:=s+z; end; g:=0; m:=1000000; work(1); if m=1000000 then writeln('Impossible') else writeln(m); end. Edited by author 06.09.2006 18:24 Re: what is test 3? Послано AlexF 6 сен 2006 22:55 Try this! wwww wwww wwww wwww Your answer is 4, but the right answer is 0 Re: what is test 3? Thank you vary much! I get ac. But how can you get the testdata? Can you give me some ural's testdata? This is my e-mail: liuxuelxg@163.com Thank you! Re: what is test 3? Послано AlexF 9 сен 2006 23:02 I haven't got the testdata!)) That was just the first test I tried to check your program!)) |
|
|