bcatch.pas
来自「Magio牛的usaco源代码」· PAS 代码 · 共 33 行
PAS
33 行
{
PROB:bcatch
LANG:PASCAL
}
program bcatch;
const
maxw=30;
var
best:array[-1..maxw]of word;
t,w,i,j,x:word;
function min(a,b:word):word;
begin
if a<b then min:=a else min:=b;
end;
begin
assign(input,'bcatch.in');reset(input);
assign(output,'bcatch.out');rewrite(output);
read(t,w);
for i:=1 to t do begin
read(x);
for j:=min(i,w) downto 0 do begin
if best[j-1]>best[j] then best[j]:=best[j-1];
if odd(j)<>odd(x) then inc(best[j]);
end;
end;
x:=0;
for i:=0 to w do
if best[i]>x then x:=best[i];
writeln(x);
close(input);close(output);
end.
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?