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

PERMU Pascal

var a,d:array[0..1000000] of longint;
    n,i,res:longint;
    
procedure nhap_va_dem;
begin
    readln(n);
    for i:=1 to n do
    begin
        read(a[i]);
        if a[i]<=n then 
            inc(d[a[i]]);
    end;
end;

procedure giai;
begin
    res:=0;
    for i:=1 to n do
         if d[i]=0 then 
             inc(res);
    write(res);
end;

begin
    assign(input,'permu.inp');reset(input);
    assign(output,'permu.out');rewrite(output);
    nhap;
    giai;
    
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.