十字方阵Pascal
var a:array[0..100,0..100] of longint;
m,i,f,k,n,x,y,j:integer;
begin
readln(n);
f:=1; k:=n; x:=1; y:=0; m:=0;
while m<n*n do
begin
for i:=1 to k do
begin
y:=y+f;
m:=m+1;
a[x,y]:=m;
end;
k:=k-1;
for i:=1 to k do
begin
x:=x+f;
m:=m+1;
a[x,y]:=m;
end;
if f=1 then f:=-1 else f:=1;
end;
for i:=1 to n do
begin
for j:=1 to n do
write(a[i,j]:5);
writeln;
end;
end.
var a:array[1..4,1..4]of integer; n,i,j,s:integer;
begin
for i:=1 to 4 do
for j:=1 to 4 do
read(a[i,j]);
s:=0;
for i:=1 to 4 do
inc(s,a[i,i]+a[i,n+1-i]);
writeln('Sum=',s);
end.
var n,i,j,s:integer; a:array[1..63,1..63]of 0..255;
procedure crs(i,j,n:integer);
var i1,j1,n1,k,t:integer;
begin
if n=1 then begin a[i,j]:=ord('+'); exit end;
n1:=n div 2;
for i1:=0 to n-1 do
begin a[i+i1,j+n1]:=ord('|');
a[j+n1,i+i1]:=ord('-') end;
a[i+n1,j+n1]:=ord('+');
crs(i,j,n1);
crs(i,j+n1+1,n1);
crs(i+n1+1,j,n1);
crs(i+n1+1,j+n1+1,n1);
end;
begin
readln(n);
crs(1,1,n);
for i:=1 to n do
begin
for j:=1 to n do write(chr(a[i,j]));
writeln;
end;
end.
var
a:array[1..127,1..127] of char;
i,j,n:integer;
procedure step(n:integer);
var i,j,k,m:integer;
begin
if n=1 then a[n,n]:='+'
else begin
k:=(n+1) div 2;
for i:=1 to n do begin a[i,k]:='|'; a[k,i]:='-'; end;
a[k,k]:='+';
m:=k-1;
step(m);
for i:=1 to m do for j:=1 to m do begin
a[i,j+k]:=a[i,j];
a[i+k,j]:=a[i,j];
a[i+k,j+k]:=a[i,j];
end;
end;
end;
begin
readln(n);
step(n);
for i:=1 to n do begin for j:=1 to n do write(a[i,j]); writeln; end;
end.
十字方阵Pascal
var n,i,j,s:integer; a:array[1..63,1..63]of 0..255;procedure crs(i,j,n:integer);var i1,j1,n1,k,t:integer;begin if n=1 then begin a[i,j]:=ord('+'); exit end;n1:=n div 2;for i1:=0 to n-1 do begin a[i+i1,j+n1]:=ord('|');a[j+n1,i+i1]...
Turble pascal语言 数字方阵
var n,i,j,k:byte;begin readln(n);for i:=1 to n+n-1 do begin for j:=1 to n+n-1 do begin if abs(j-n)<abs(i-n) then k:=i else k:=j;write(n-abs(k-n):2);end;writeln;end;end.var a:array[1..30,1..30]of integer;n,i,j,k:integer;begin write('n=...
pascal蛇形矩阵难题
Pascal Code:Program she; const max=10; var d,i,j,m,N:integer; A:array [1..10,1..10] of integer;begin write('N=');readln(N); if (N>=1) and (N<=max) then begin i:=1;j:=1;m:=1;d:=1; repeat A[i,j]:=m; {填数} case d of 1: begin i:=i+1; if...
方阵_PASCAL
var n,i,j,k:integer;sz:array[0..40,0..40] of integer;{存储填入的数字} fxh,fxz,fxhz:boolean;begin for i:=0 to 40 do for j:=0 to 40 do sz[i,j]:=1;readln(n);for i:=1 to n do for j:=1 to n do sz[i,j]:=0;k:=0;i:=1;j:=n;fxh:=false;fxz:=...
方阵排数PASCAL进
program PL;var a:array[1..2] of shortint;i:array[1..9] of shortint;c:array[1..3] of integer;d:array[1..9] of boolean;procedure PD;begin for a[1]:=1 to 9 do if d[a[1]] then begin end else exit;for a[1]:=1 to 9 do if a[1] mod 3=0 then writeln(...
数字螺旋方阵pascal顺时针
m,i,f,k,n,x,y,j:integer;begin readln(n);f:=1; k:=n; x:=1; y:=0; m:=0;while m<n*n do begin for i:=1 to k do begin y:=y+f;m:=m+1;a[x,y]:=m;end;k:=k-1;for i:=1 to k do begin x:=x+f;m:=m+1;a[x,y]:=m;end;if f=1 then f...
pascal编程:迂回方阵怎么做
var a:array [1..100,1..100]of integer;{用一个二维数组来模拟这个方针} i,j,m,n:integer;begin read(n);{读入边长} m:=1;{把m当做技术起来用} a[n,1]:=m;{先把1这种特例定义好} for i:=2 to n do {把它看做一个从左下角开始n圈的数来写,因为1已经定义好了所以直接从2...
用Pascal语言:输入4×4方阵,分别求两条对角线上元素之和。
var a:array[1..4,1..4]of integer; n,i,j,s:integer;begin for i:=1 to 4 do for j:=1 to 4 do read(a[i,j]);s:=0;for i:=1 to 4 do inc(s,a[i,i]+a[i,n+1-i]);writeln('Sum=',s);end.
帮我唤醒一下PASCAL数组、字符的记忆,全忘了阿……
一维数组 a:array[1..10] of integer;这个数组 A[]中可以放10个数;二维数组 a;araray[1..10,1..10] of integer;这个数组可以 写出 一个边长为10的方阵;最多2维 *_你可以用立体在电脑上写东西啊?
pascal 的初级题
57. 跳马问题,5*5方阵,从左上角出发,跳遍所有格.58. 一梯子有N格,小明上梯子有时一步上1格,有时一步上2格,编一程序,对任意输入的自然数N,打印出上梯子的所有可能的上法,并指出一共有多少种上法?59. 第 13 届世界杯足球赛进入前八名的国家: ARGENTINA(阿根廷),ENGLAND(英格兰),SPAIN(西班牙),BELGIUM...
茶疫乳酸: 帕斯卡矩阵:由杨辉三角形表组成的矩阵称为帕斯卡(Pascal)矩阵. 杨辉三角形表是二次项 (x+y)^n 展开后的系数随自然数 n 的增大组成的一个三角形表. 如4阶帕斯卡矩阵为: Pascal(4)= [1 1 1 1 1 2 3 4 1 3 6 10 1 4 10 20]
砚山县19837815692: PASCAL矩阵 - ?
茶疫乳酸: program p4; const n=4;m=5; var a:array[1..n,1..m] of word; b,f:array[1..n] of word; c,g:array[1..m] of word; d,e,i,j:integer; begin assign(input,'p4.in');reset(input); assign(output,'p4.out');rewrite(output); for i:=1 to n do for j:= 1 to m do read(a[i,j]); for i:=1 ...
砚山县19837815692: Pascal 矩阵乘法 - ?
茶疫乳酸: program juzhen; var a,b,c:array[1..100,1..100] of integer; m,n,h,i,j,s,k:integer; begin write('m=');read(m); write('n=');read(n); write('h=');read(h); writeln('Input A:'); for i:=1 to m do for j:=1 to n do read(a[i,j]); writeln('Input B:'); for i:=1 to n do for j:=1 to h do ...
砚山县19837815692: 如何用pascal语言二维数组打出如下方阵 n=4时 10 11 12 1 9 16 13 2 8 15 14 3 7 - ?
茶疫乳酸: var f:array[1..100,1..100] of integer; i,,j,k,n:integer; begin readln(n) for i:=1 to n do for j:=1 to n do read(f[n,n]);//读入数据 for i:=1 to n do begin for j:=1 to n do write(f[n,n]);//输出 writeln;//换行 end; end.
砚山县19837815692: pascal拐角方阵 - ?
茶疫乳酸: var i,n:longint; function max(a,b:longint):longint; begin if(a>b)then exit(a); exit(b); end; begin readln(n); for i:=1 to n*n do begin write(n-max(n-((i-1) mod n+1),(i-1) div n):3); if(i mod n = 0)then writeln; end; end.
砚山县19837815692: pascal螺旋矩阵 - ?
茶疫乳酸: var n,a,b:integer; begin read(n); a:=1; b:=0; for a:= 1 to n do repeat write(chr(ord(a)+b)); b:=b+1; until b>n;b:=0;writeln; end.
砚山县19837815692: Pascal 打印方阵!!谢谢. - ?
茶疫乳酸: var i,j,k:word; zl:array[1..5] of char=('A','B','C','D','E'); begin for i:=1 to 5 do begin for j:=i to 5 do write(zl[j],' '); for k:=1 to abs(1-i) do write(zl[k],' '); writeln; end; end.帅哥,给我点钱吧!
砚山县19837815692: pascal 矩阵的转置 - ?
茶疫乳酸: 假如矩阵已在A数组中,通过以下循环即可将其转置到B数组中.for i:=1 to 3 do for j:=1 to 4 do b[j,i]:=a[i,j]; 完成后即可打印.
砚山县19837815692: 数字螺旋方阵pascal顺时针 - ?
茶疫乳酸: var a:array[0..100,0..100] of longint; m,i,f,k,n,x,y,j:integer; begin readln(n); f:=1; k:=n; x:=1; y:=0; m:=0; while m begin for i:=1 to k do begin y:=y+f; m:=m+1; a[x,y]:=m; end; k:=k-1; for i:=1 to k do begin x:=x+f; m:=m+1; a[x,y]:=m; end; if f=1 then f:=-1 else...
砚山县19837815692: 求PASCAL邻接表和邻接矩阵的具体用法 - ?
茶疫乳酸: 邻接矩阵a[i,j] 表示点i,j之间的路程,如果任意i,j都有a[i,j]=a[j,i]那么这个图就是一个无向图.邻接表a[i],a[i]表示一个链表,里面依次存储每个和i相连的点k,i,k的距离,和next;如用.data .n .next 分别表示这个点的编号,这个点到i的距离和连接下一个...