ac1134.pas
来自「Ural(Acm.timus.ru)题解 By Maigo大牛」· PAS 代码 · 共 30 行
PAS
30 行
program ural1134;
const
maxn=1000;
var
c:array[0..maxn]of integer;
n,m,i,x:integer;
procedure no;
begin
writeln('NO');
halt;
end;
begin
fillchar(c,sizeof(c),0);
readln(n,m);
for i:=1 to m do begin
read(x);
inc(c[x]);
end;
for i:=1 to n do
if (c[i-1]=0) and (c[i]=0) then
inc(m)
else begin
if c[i-1]>0 then dec(c[i-1]) else dec(c[i]);
if c[i-1]>0 then no;
end;
if m<>n then no;
writeln('YES');
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?