|
|
back to boardThis is my very simple solution in Pacal! program Project2; var a:array[1..100,1..100] of integer; k,p,n,i,j,s:integer; begin readln(n); k:=0; p:=n-1; for s:=1 to (n*2-1) do begin for i:=1 to n do for j:=1 to n do if j-i=p then begin k:=k+1; a[i,j]:=k end; p:=p-1 end; for i:=1 to n do begin for j:=1 to n do begin write(a[i,j]); write(' ') end; writeln end; end. |
|
|