Luogu P4122 [USACO17DEC]Blocked Billboard
Luogu P4122 [USACO17DEC]Blocked Billboard
解析
- 画图想一想,莫得想复杂咯!
Code
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#define LL long long
using namespace std;
struct matrix
{
int ax,ay,bx,by;
}mat[5];
int ares;
int main()
{
for(int i=1;i<=3;i++) scanf("%d%d%d%d",&mat[i].ax,&mat[i].ay,&mat[i].bx,&mat[i].by);
ares=(mat[1].bx-mat[1].ax)*(mat[1].by-mat[1].ay)+(mat[2].bx-mat[2].ax)*(mat[2].by-mat[2].ay);
ares-=max(0,min(mat[1].bx,mat[3].bx)-max(mat[1].ax,mat[3].ax))*max(0,min(mat[1].by,mat[3].by)-max(mat[1].ay,mat[3].ay));
ares-=max(0,min(mat[2].bx,mat[3].bx)-max(mat[2].ax,mat[3].ax))*max(0,min(mat[2].by,mat[3].by)-max(mat[2].ay,mat[3].ay));
printf("%d\n",ares);
return 0;
}
Classical is something not fade,but grow more precious with time pass by,so is dream.梦想这东西和经典一样,永远不会因为时间而褪色,反而更显珍贵。