Created
September 20, 2014 04:13
-
-
Save haroldxin/0bb0a1139f7ed6d10149 to your computer and use it in GitHub Desktop.
Rectangle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const | |
max=100; | |
fin='rectangle.in'; | |
fout='rectangle.out'; | |
var | |
f:array[0..max+1,0..max+1] of integer; | |
n,k,i,j,x1,y1,x2,y2,ans:integer; | |
begin | |
assign(input,fin); reset(input); | |
assign(output,fout);rewrite(output); | |
fillchar(f,sizeof(f),0); | |
readln(n); | |
for k:=1 to n do | |
begin | |
readln(x1,y1,x2,y2); | |
for i:=x1+1 to x2 do | |
for j:=y1+1 to y2 do f[i,j]:=1; | |
end; | |
ans:=0; | |
for i:=0 to max+1 do | |
for j:=0 to max+1 do inc(ans,f[i,j]); | |
writeln(ans); | |
close(input);close(output); | |
end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment