|
|
back to boardWhat mean integer num of meter? First i Think that it means horisontal and vertical num? but when i have written my program it did not pass that test! What mean integer num of meter? What's wrong? It's just simple problem but what's wrong? type longint = int64; var count,n,m,i,j,ii,jj:system.longint; Colors: array [1..50,1..50] of longint; a : array [1..50,1..50] of longint; sq : array [1..5000] of extended; can : array [1..5000] of boolean; C:char; begin assign(input,'input.txt');reset(input); assign(output,'output.txt');rewrite(output); readln(n,m); for i:= 1 to n do begin for j:= 1 to m do begin read(c); case c of 'B': Colors[i,j] := 0; 'W': Colors[i,j] := 1; end; end; readln; end; for i:= 1 to n do for j:=1 to m do read(a[i,j]); for i:= 1 to 5000 do sq[i] := sqrt(i); for i:= 1 to 5000 do can[i] := sqr(trunc(sq[i])) = i; for i:= 1 to n do begin for j:= 1 to m do begin count := 0; for ii := 1 to n do for jj := 1 to m do begin if (i = ii) or (j = jj) then count := Count + a[ii,jj] else begin if can[(i - ii)*(i - ii) + (j - jj)*(j - jj)] then inc(count,a[ii,jj]); end; end; if count mod 2 = 1 then Colors[i,j] := (Colors[i,j] + 1) mod 2; if Colors[i,j] = 0 then write('B') else write('W'); end; writeln; end; close(input);close(output); end. |
|
|