比赛 NOIP_3 评测结果 WWWWWWWWWA
题目名称 填数 最终得分 10
用户昵称 zpl123 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-10-19 11:58:48
显示代码纯文本
program tianshu;
const
sushu:array[1..46] of integer=(2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199);
var
n:integer;
ans:array[1..10,1..10]of integer;

function judge(k:integer):boolean;
var
i:integer;
begin
judge:=false;
for i:=1 to 47 do if k=sushu[i] then judge:=true;
end;

procedure ini;
begin
assign(input,'tianshu.in');
reset(input);
assign(output,'tianshu.out');
rewrite(output);
readln(n);
close(input);
fillchar(ans,sizeof(ans),0);
ans[1,1]:=1;
end;

procedure print;
var
i,j:integer;
begin
for i:=1 to n do
 begin
 for j:=1 to n-1 do
 write(ans[i,j],' ');
 writeln(ans[i,n]);
 end;
end;


procedure try(i:integer);
var
k:integer;
begin
k:=1;
if (i=n+1)and(k=n) then print;
if i>n then begin inc(k); try(1); end;
if k=1 then begin

            end;
end;

begin
ini;
if n=2 then begin writeln('1',' ','2');  writeln('4',' ','3'); end
       else try(2);
close(output);
end.