比赛 NOIP2008集训模拟4 评测结果 AWWAWAWWAW
题目名称 彩色穿孔卡片 最终得分 40
用户昵称 name:弓虽 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-11-13 10:59:47
显示代码纯文本
program punch(input,output);
type
 rec=record
  x,y:longint;
  end;
 var
 f:boolean;
  i,j,k:longint;
  n:longint;
  a:array [1..10001] of rec;
  ans:longint;
begin
 assign(input,'punch.in');
 assign(output,'punch.out');
 reset(input);
 rewrite(output);
 readln(n);
  for i:=1 to n do
   readln(a[i].x,a[i].y);
   ans:=1;
 for i:= 2 to n do begin
 f:=true;
  if (a[i].x<=a[i-1].x)and(a[i].y>=a[i-1].y)and (f)
   then begin
    ans:=ans+0;
    f:=false;
    end;
  if (a[i].x>a[i-1].x) and (a[i].y<=a[i-1].y)and (f)
   then  begin
    ans:=ans+1;
    f:=false;
    end;
  if (a[i].x>=a[i-1].x) and (a[i].y<a[i-1].y)and (f)
   then
   begin
   ans:=ans+1;
   f:=false;
   end;
  if (a[i].x>=a[i-1].x) and (a[i].y>a[i-1].y) and (a[i].x<a[i-1].y) and (f)
   then   begin
    ans:=ans+1;
    f:=false;
    end;
  if (a[i].x<a[i-1].x) and (a[i].y<=a[i-1].y) and (a[i].y>a[i-1].x) and (f)
   then  begin
    ans:=ans+1;
    f:=false;
    end;
  if (a[i].x>=a[i-1].y) and (f)
   then begin
   ans:=ans+1;
   f:=false;
   end;
  if (a[i].y<=a[i-1].x) and (f)
   then begin
   ans:=ans+1;
   f:=false;
   end;
  end;
  writeln(ans);
  close(input);
  close(output);
  end.