记录编号 244704 评测结果 AAAAAAAAAAAAAAA
题目名称 2201.[USACO Dec15] 卡牌游戏(银组) 最终得分 100
用户昵称 Gravatar萌萌哒姐姐 是否通过 通过
代码语言 Pascal 运行时间 0.085 s
提交时间 2016-04-01 20:41:26 内存使用 11.61 MiB
显示代码纯文本
var i,m,n,sum,j,k,cishu:longint;
a,b,c:array[1..1000000] of longint;
begin 
	assign(input,'highcard.in');reset(input);
	assign(output,'highcard.out');rewrite(output);
	readln(n);
	for i:=1 to n do 
		begin
			readln(m);
			a[m]:=m;
		end;
		j:=0;k:=0;sum:=n;
	for i:=1 to 2*n do 
		begin
			if a[i]<>0 then begin inc(j); b[j]:=i; end;
		end;
	for i:=1 to 2*n do 
		begin
			if a[i]=0 then begin inc(k); c[k]:=i end;
		end;
	j:=n+1;k:=n+1;
	repeat
		dec(j);dec(k);
		if b[j]>c[k] then begin  inc(k);dec(sum); end;
		inc(cishu);
	until cishu=n;
	writeln(sum);
	close(input);close(output);
end.