迎春舞会之数字舞蹈
题意
打印图案
分析
仔细看输出,理解题意,思路清晰就能做出这题。
var
i,j,k,a:longint;
s:ansistring;
p:array[0..9,1..5]of longint=((1,1,0,1,1),(0,2,0,2,0),(1,2,1,3,1),(1,2,1,2,1),(0,1,1,2,0),(1,3,1,2,1),(1,3,1,1,1),(1,2,0,2,0),(1,1,1,1,1),(1,1,1,2,1));
procedure print(c:longint;c1:longint);
var
l:longint;
begin
if(c=1)then
begin
if(c1=1)then
begin
write(' ');
for l:=1 to k do
write('-');
write(' ');
end else
if(c1=0)then
begin
write(' ');
for l:=1 to k do
write(' ');
write(' ');
end;
end else
if(c=2)then
begin
if(c1=1)then
begin
write('|');
for l:=1 to k do
write(' ');
write('| ');
end else
if(c1=2)then
begin
write(' ');
for l:=1 to k do
write(' ');
write('| ');
end else if(c1=3)then
begin
write('|');
for l:=1 to k do
write(' ');
write(' ');
end;
end;
exit;
end;
begin
readln(k);
readln(s);
for j:=1 to length(s) do
begin
val(s[j],a);
print(1,p[a][1]);
end;
writeln;
for i:=1 to k do
begin
for j:=1 to length(s) do
begin
val(s[j],a);
print(2,p[a][2]);
end;
writeln;
end;
for j:=1 to length(s) do
begin
val(s[j],a);
print(1,p[a][3]);
end;
writeln;
for i:=1 to k do
begin
for j:=1 to length(s) do
begin
val(s[j],a);
print(2,p[a][4]);
end;
writeln;
end;
for j:=1 to length(s) do
begin
val(s[j],a);
print(1,p[a][5]);
end;
readln;
readln;
end.