比赛 NOIP2008集训模拟4 评测结果 C
题目名称 彩色穿孔卡片 最终得分 0
用户昵称 NickName 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-13 11:01:59
显示代码纯文本
program punch;
var n:longint;
card:array[1..10000,1..2] of longint;
hash:array[1..10000] of boolean;
sy:longint;
x1,x2:longint;
pi,po:text;
jg:=longint;
p:boolean;
begin
assign(pi,'punch.in');
reset(pi);
readln(pi,n);
assign(po,'punch.out');
rewrite(po);
sy:=n;
jg:=0;
fillchar(hash,sizeof(hash),false);
for x1:=1 to n do
readln(pi,card[x1,1],card[x1,2]);
close(pi);
for x1:=n downto 1 do
begin
if sy=0 then
begin
writeln(po,jg);
halt;
end
else
begin
p:=false;
for x2:=card[x1,1]+1 to card[x1,2] do
if hash[x2]=false then
begin
p:=true;
hash[x2]:=true;
end;
if p=true then inc(jg);
end;

end;
writeln(po,jg);
close(po);
end.