Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

要注意的问题(附代码)

Posted by lifeich1 at 2010-02-15 22:59:32 on Problem 1102
首先每个数字都有一列的空格,但最后一行不用。
输出一组数据(换了行),要再换一次行。
如果这两个问题都解决了还PE就是程序的问题了。

============^_^我是分割线^_^================

var
    v:array[0..100] of longint;
    a,n,i,j,k:longint;

begin
    readln(a,n);
    while a>0 do begin
        fillchar(v,sizeof(v),0);
        if n>0 then begin
            while n>0 do begin
                inc(v[0]);
                v[v[0]]:=n mod 10;
                n:=n div 10;
            end;
        end else v[0]:=1;
        for i:=v[0] downto 1 do begin
            if i<v[0] then write(' ');
            case v[i] of
                1,4:for j:=1 to a+2 do write(' ');
                2,3,5,6,7,8,9,0:begin
                    write(' ');
                    for j:=1 to a do write('-');
                    write(' ');
                end;
            end;
        end;
        writeln();
        for k:=1 to a do begin
            for i:=v[0] downto 1 do begin
                if i<v[0] then write(' ');
                case v[i] of
                    1,2,3,7:begin
                        for j:=1 to a+1 do write(' ');
                        write('|');
                    end;
                    4,8,9,0:begin
                        write('|');
                        for j:=1 to a do write(' ');
                        write('|');
                    end;
                    5,6:begin
                        write('|');
                        for j:=1 to a+1 do write(' ');
                    end;
                end;
            end;
            writeln();
        end;
        for i:=v[0] downto 1 do begin
            if i<v[0] then write(' ');
            case v[i] of
                1,7,0:begin
                    for j:=1 to a+2 do write(' ');
                end;
                2,3,4,5,6,8,9:begin
                    write(' ');
                    for j:=1 to a do write('-');
                    write(' ');
                end;
            end;
        end;
        writeln();
        for k:=1 to a do begin
            for i:=v[0] downto 1 do begin
                if i<v[0] then write(' ');
                case v[i] of
                    1,3,4,5,7,9:begin
                        for j:=1 to a+1 do write(' ');
                        write('|');
                    end;
                    6,8,0:begin
                        write('|');
                        for j:=1 to a do write(' ');
                        write('|');
                    end;
                    2:begin
                        write('|');
                        for j:=1 to a+1 do write(' ');
                    end;
                end;
            end;
            writeln();
        end;
        for i:=v[0] downto 1 do begin
            if i<v[0] then write(' ');
            case v[i] of
                1,4,7:for j:=1 to a+2 do write(' ');
                2,3,5,6,8,9,0:begin
                    write(' ');
                    for j:=1 to a do write('-');
                    write(' ');
                end;
            end;
        end;
        writeln();
        readln(a,n);
        writeln();
    end;
end.

打得有点太长了,大家忍耐一下(这题很水呐)

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator