记录编号 8150 评测结果 AWAWEEWWAW
题目名称 [BYVoid S3] 彩色穿孔卡片 最终得分 30
用户昵称 GravatarMayLava 是否通过 未通过
代码语言 Pascal 运行时间 0.102 s
提交时间 2008-11-13 11:37:34 内存使用 0.13 MiB
显示代码纯文本
program MayLava;

var
 list:array[0..10000]of integer;
 flag:array[1..1000]of boolean;
 n,sum:longint;

procedure printn;
 var
  f:text;
 begin
  assign(f,'punch.out');
  rewrite(f);
  writeln(f,n);
  close(f);
  halt;
 end;

procedure main;
 var
  i,j,x,y:longint;
  f:text;
 begin
  fillchar(list,sizeof(list),0);
  fillchar(flag,sizeof(flag),true);
  assign(f,'punch.in');
  reset(f);
  readln(f,n);
  if n>1000 then printn;
  for i:=1 to n do begin
   readln(f,x,y);
   for j:=x to y-1 do
    list[j]:=i;
  end;
  close(f);
 end;

procedure print;
 var
  i:longint;
  f:text;
 begin
  for i:=0 to 10000 do
   if (list[i]<>0) and flag[list[i]] then begin
    inc(sum);
    flag[list[i]]:=false;
   end;
  assign(f,'punch.out');
  rewrite(f);
  writeln(f,sum);
  close(f);
 end;

BEGIN
 main;
 print;
END.