Thứ Tư, 27 tháng 4, 2022

ROLLING PASCAL

var a,b,c,i,j:longint;
res,n:int64;
procedure di;
var
t:integer;
begin
        t:=a;
        a:=b;
        b:=7-t;
        res:=res+7-a
end;
procedure queo;
var
t:longint;
begin
        t:=c;
        c:=7-b;
        b:=t;
end;
begin
        assign(input,'ROLLING.INP');reset(input);
        assign(output,'ROLLING.OUT');rewrite(output);
        read(n);
        a:=1;
        b:=2;
        c:=3;
        res:=6;
        while n>1 do
        begin
                for i:=1 to 3 do
                begin
                        for j:=1 to n-1 do
                                di;
                        queo;
                end;
                for i:=1 to n-2 do
                        di;
                if n>2 then
                begin
                        queo;
                        di;
                end;
                n:=n-2;
        end;
        write(res);
end.

Không có nhận xét nào:

Đăng nhận xét

Lưu ý: Chỉ thành viên của blog này mới được đăng nhận xét.