比赛 暑假培训四 评测结果 WWWEWEWT
题目名称 求图形面积 最终得分 0
用户昵称 辨机ZN 运行时间 0.000 s
代码语言 Pascal 内存使用 0.00 MiB
提交时间 2008-07-21 12:03:48
显示代码纯文本
program ex(f1,f2);
 type
  ha=array [1..64] of integer;
  zn=array [-100..100,-100..100] of 1..64;
  ka=array [1..4] of integer;
 var
  a:zn; f1,f2:text; i,j,n,m,k,chang,kuan,t:integer;
  x1,x2,y1,y2,xx1,xx2,yy1,yy2:integer;  p:ha;
 begin
  assign(f1,'area.in'); reset(f1);
  assign(f2,'area.out'); rewrite(f2);
  readln(f1,chang,kuan,n);
  xx1:=100; xx2:=-100;
  yy1:=100; yy2:=-100;
  for i:=1 to n do
   begin
    readln(f1,x1,x2,y1,y2,t);
    if xx1<x1 then xx1:=x1;
    if yy1<y1 then yy1:=y1;
    if xx2>x2 then xx2:=x2;
    if yy2>y2 then yy2:=y2;
    for j:=x1 to y1 do
     for k:=x2 to y2 do
      a[j,k]:=t;
   end;
  for i:=xx1 to yy1 do
   for j:=xx2 to yy2 do
    begin
     p[a[i,j]]:=p[a[i,j]]+1;
    end;
  for i:=1 to 64 do
   if p[i]<>0 then writeln(f2,i,' ',p[i]);
   close(f1);
   close(f2);
  end.