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

GHISO PASCAL

var n,d:longint;
begin
    assign(input,'ghiso.inp');reset(input);
    assign(output,'ghiso.out');rewrite(output);
    readln(n);
    d:=0;
    while n > 0 do
    begin    
        if n mod 2 = 0 then 
            n:=n div 2 
        else 
            dec(n);
        inc(d);
    end;
    write(d);
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.