HDU 2056
来源:互联网 发布:it618淘宝客导购 编辑:程序博客网 时间:2024/06/08 02:05
#include <stdio.h>#include <iostream>#include <math.h>using namespace std;int main(){ double c,w,g; double x1,x2,x3,x4,y1,y2,y3,y4,t; while(scanf("%lf %lf %lf %lf %lf %lf %lf %lf",&x1,&y1,&x2,&y2,&x3,&y3,&x4,&y4)!=EOF) { if (x1>x2) t=x1,x1=x2,x2=t; if (y1>y2) t=y1,y1=y2,y2=t; if (x3>x4) t=x3,x3=x4,x4=t; if (y3>y4) t=y3,y3=y4,y4=t; x1=max(x1,x3); y1=max(y1,y3); x2=min(x2,x4); y2=min(y2,y4); printf("%.2lf\n",x1>x2||y1>y2?0:(x2-x1)*(y2-y1)); }}
一道超级水题,但是我居然是3A.................好吧,其实就是判断矩阵重叠的部分。
只要判断好边界和0值就好。我读题的时候还以为x1=y1,x2=y2,x3-=y3,x4=y4。是在不应该。
基本上一般的都会1A吧。
- hdu 2056
- HDU-2056
- HDU 2056
- HDU 2056
- hdu 2056
- HDU--2056
- HDU 2056
- hdu 2056
- hdu 2056
- hdu 2056 Rectangles
- HDU 2056 Rectangles
- hdu 2056 Rectangles
- HDU 2056 Rectangles
- HDU 2056 rectangles
- HDU - 2056 Rectangles
- HDU 2056 Rectangles
- HDU 2056 Rectangles
- HDU 2056 Rectangles
- eMule Server.met 格式解析
- Qt学习——聊天的QQ列表QToolBox类
- hdu 1052
- 【设计模式】创建型模式-工厂方法
- 父试图和子试图不能全都打开用户交互
- HDU 2056
- gridview分頁:第一頁 下一頁 1 2 3 4 上一頁 最末頁
- JAVA虚拟机参数设置
- 漂亮的checkbox样式 (多选框)
- 多线程
- Qt制作QQ好友列表
- linux 根目录的来由
- Micaps3.2二次开发实例教程-14
- 可激活的间隔任务执行器