Chủ Nhật, 26 tháng 6, 2022

DAO507 PASCAL

var i,n,s,d:longint;
begin
    assign(input, 'dao507.inp');reset(input);
    assign(output, 'dao507.out');rewrite(output);
    read(n);
    d:=0;
    while n>2 do
    begin
        if (n mod 2=0) then
        begin
            n:=n div 2;
            d:=d+4;
        end
        else
        begin
            dec (n);
            inc(d,2);
        end;
    end;
    write(d+2);    //buoc cuoi luon chon lenh c1
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.