Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //https://www.facebook.com/groups/thegioilaptrinh/permalink/1376965755772113/?comment_id=1377120149090007&reply_comment_id=1377302102405145¬if_id=1539840327155378¬if_t=group_comment
- uses crt;
- var a:array[1..100,1..100] of longint;
- n,i,j:longint;
- procedure print;
- var i,j:longint;
- begin
- for i:=1 to n do
- begin
- writeln;
- for j:=1 to n do write(a[i,j],' ');
- end;
- end;
- begin
- readln(n);
- for i:=1 to n do
- for j:=1 to n do
- begin
- if (i*j<=2*n) then a[i,j]:=i*j;
- if (i*j>2*n) and ((i*(j-1))<=2*n) then a[i,j]:=2;
- if (i=n) and (i*j>2*n) and (i*(j-1)<=2*n) then a[i,j]:=4;
- if (i*j>2*n) and ((i*(j-1))>2*n) then a[i,j]:=a[i,j-1]+2;
- end;
- print;
- readln
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement