PersonalCorpus 版 (精华区)

276786 09:46:25 14 Nov 2002 Big Guava
1222 Pascal Accepted 0.02 sec 53K

program p1222;

need funcs.inc

begin

{$IFNDEF ONLINE_JUDGE}
    assign(input,'input1222.txt');reset(input);
    assign(output,'output1222.txt');rewrite(output);
{$ENDIF}

    readln(n);
    if n<5 then writeln(n)
    else if (n mod 3) =1 then begin
        setlengthLI(t,1);
        setvalueLI(t,1,4);
        while n<>4 do begin
            n:=n-3;
            mulli(t,3);
        end;
        printLI(t);
    end else if (n mod 3)=2 then begin
        setlengthLI(t,1);
        setvalueLI(t,1,2);
        while n<>2 do begin
            n:=n-3;
            mulli(t,3);
        end;
        printLI(t);
    end else begin
        setlengthLI(t,1);
        setvalueLI(t,1,3);
        while n<>3 do begin
            n:=n-3;
            mulli(t,3);
        end;
        printLI(t);
    end;
end.
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:5.272毫秒