题目描述
给出数字的大小k,用“ ”、“-”和“|”组成一系列数字。
样例输入
2
1234567890
样例输出
-- -- -- -- -- -- -- --
| | | | | | | | | | | | | |
| | | | | | | | | | | | | |
-- -- -- -- -- -- --
| | | | | | | | | | | | |
| | | | | | | | | | | | |
-- -- -- -- -- -- --
思路
相信也看出来了,这就是一个水题啊~~~不过注意空格的个数,数字两两之间存在一个空格。
var
a:
string;
i,j,k,l,n:longint;
begin
readln(n);
readln(a);
for i:=
1 to length(a)
do
begin
write(
' ');
if (a[i]=
'1')
or(a[i]=
'4')
then
for j:=
1 to n
do write(
' ')
else
for j:=
1 to n
do write(
'-');
write(
' ');
end;
writeln;
for i:=
1 to n
do
begin
for j:=
1 to length(a)
do
begin
if (a[j]=
'1')
or(a[j]=
'2')
or(a[j]=
'3')
or(a[j]=
'7')
then
begin
for k:=
1 to n+
1 do write(
' ');
write(
'| ');
end
else
if (a[j]=
'5')
or(a[j]=
'6')
then
begin
write(
'|');
for k:=
1 to n+
2 do write(
' ');
end
else
begin
write(
'|');
for k:=
1 to n
do write(
' ');
write(
'| ');
end;
end;
writeln;
end;
for i:=
1 to length(a)
do
begin
write(
' ');
if (a[i]=
'1')
or(a[i]=
'7')
or(a[i]=
'0')
then
for j:=
1 to n
do write(
' ')
else
for j:=
1 to n
do write(
'-');
write(
' ');
end;
writeln;
for i:=
1 to n
do
begin
for j:=
1 to length(a)
do
begin
if (a[j]=
'1')
or(a[j]=
'3')
or(a[j]=
'4')
or(a[j]=
'5')
or(a[j]=
'7')
or(a[j]=
'9')
then
begin
for k:=
1 to n+
1 do write(
' ');
write(
'| ');
end
else
if a[j]=
'2' then
begin
write(
'|');
for k:=
1 to n+
2 do write(
' ');
end
else
begin
write(
'|');
for k:=
1 to n
do write(
' ');
write(
'| ');
end;
end;
writeln;
end;
for i:=
1 to length(a)
do
begin
write(
' ');
if (a[i]=
'1')
or(a[i]=
'4')
or(a[i]=
'7')
then
for j:=
1 to n
do write(
' ')
else
for j:=
1 to n
do write(
'-');
write(
' ');
end;
writeln;
end.
转载请注明原文地址: https://ju.6miu.com/read-661762.html