hdu5258简单枚举
百度之星复赛第一题。不明白这么水的题为何一堆人没过。。。这些人是咋晋级复赛的呢。。。
/*
* Author : ben
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <queue>
#include <set>
#include <map>
#include <stack>
#include <string>
#include <vector>
#include <deque>
#include <list>
#include <functional>
#include <numeric>
#include <cctype>
using namespace std;
typedef struct Bang {
int x1, x2;
int y1, y2;
Bang(int xx1 = , int yy1 = , int xx2 = , int yy2 = ) {
x1 = xx1;
x2 = xx2;
y1 = yy1;
y2 = yy2;
}
} Bang;
Bang heng[], shu[];
int N, M, ans;
bool isCross(const Bang &b1, const Bang &b2) {
if (b2.x1 >= b1.x1 && b2.x1 <= b1.x2) {
if (b1.y1 >= b2.y1 && b1.y1 <= b2.y2) {
return true;
}
}
return false;
}
void work() {
for (int i = ; i < N; i++) {
for (int j = i + ; j < N; j++) {
for (int a = ; a < M; a++) {
if (!isCross(heng[i], shu[a]) || !isCross(heng[j], shu[a])) {
continue;
}
for (int b = a + ; b < M; b++) {
if (isCross(heng[i], shu[b]) && isCross(heng[j], shu[b])) {
ans++;
}
}
}
}
}
} int main() {
int T, n;
int x1, x2, y1, y2;
scanf("%d", &T);
for (int t = ; t <= T; t++) {
N = ;
M = ;
ans = ;
scanf("%d", &n);
for (int i = ; i < n; i++) {
scanf("%d%d%d%d", &x1, &y1, &x2, &y2);
if (x1 == x2) {
shu[M++] = Bang(x1, min(y1, y2), x2, max(y1, y2));
} else {
heng[N++] = Bang(min(x1, x2), y1, max(x1, x2), y2);
}
}
work();
printf("Case #%d:\n%d\n", t, ans);
}
return ;
}
hdu5258简单枚举的更多相关文章
- UVA - 10167 - Birthday Cake    (简单枚举)
		思路:简单枚举 AC代码: #include <cstdio> #include <cstring> #include <iostream> #include &l ... 
- Java练习 SDUT-1959_简单枚举类型——植物与颜色
		简单枚举类型--植物与颜色 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 请定义具有red, orange, yell ... 
- hdu5073 简单枚举+精度处理
		其实这题还是挺简单的,因为移动k个星球后,这k个星球的权值就可以变为0,所以只有剩下的本来就是连着的才是最优解,也就是说要动也是动两端的,那么就O(N)枚举一遍动哪些就好了. 我是在杭电oj题目重现的 ... 
- zoj 1622 Switch 开关灯 简单枚举
		ZOJ Problem Set - 1622 Switch Time Limit: 2 Seconds Memory Limit: 65536 KB There are N lights i ... 
- UVa 725 简单枚举+整数转换为字符串
		Division Write a program that finds and displays all pairs of 5-digit numbers that between them use ... 
- UVA 725  UVA 10976 简单枚举
		UVA 725 题意:0~9十个数组成两个5位数(或0开头的四位数),要求两数之商等于输入的数据n.abcde/fghij=n. 思路:暴力枚举,枚举fghij的情况算出abcde判断是否符合题目条件 ... 
- uva 10976 Fractions Again(简单枚举)
		10976 Fractions Again It is easy to see that for every fraction in the form 1 k (k > 0), we can a ... 
- C#枚举的简单使用
		枚举这个名词大家都听过,很多小伙伴也使用过, 那么枚举在开发中能做什么,使用它后能给程序代码带来什么改变,为什么用枚举. 各位看官且坐下,听我一一道来. 为什么使用枚举? 1.枚举能够使代码更加清晰, ... 
- 做 fzu oj 1003 简单的枚举
		暴力求解法---简单枚举 定义一个函数(函数的内容大概是包含了题目所给的限制条件),然后主函数就是通过循环进行枚举,枚举出可能的元素,带入函数中进行验证,如果符合函数所给的情况,则为其解. 
随机推荐
- grep用法详解:grep与正则表达式【转】
			转自:http://blog.csdn.net/hellochenlian/article/details/34088179 grep用法详解:grep与正则表达式 首先要记住的是: 正则表达式与通配 ... 
- dpkg --add-architecture i386 && apt-get update && > apt-get install wine32
			dpkg --add-architecture i386 && apt-get update &&> apt-get install wine32 
- AC日记——Milking Grid poj 2185
			Milking Grid Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 8314 Accepted: 3586 Desc ... 
- 牛客网 牛客小白月赛1 A.简单题-控制输出格式setiosflags()函数+setprecision()函数
			水一水博客,都不好意思写这篇博客,毕竟已经不是大一的了. 难得能把一整套题都写出来(日常智障).但是在这里不写G题あなたの蛙は旅⽴っています的题解. 有毒,G题关了流同步只能过94%的样例,说我运行超 ... 
- Javascript 限制文本字节数
			文本限制字数的问题,在实际开发中经常用到;主要问题出现在对中文的限制,下面代码就解决关于限制字节数的校验问题 以下是引用片段: /* value: 值: byteLength:数据库字节长度 titl ... 
- python安装numpy和matplotlib
			1.从该链接下载对应的whl文件 2.按照下面的方式从whl文件安装即可 windows7 python2.7 1.用管理员方式打开cmd 2.首先通过pip命令安装wheel 如果提示’pip’不是 ... 
- lms111,rplidar 方向和起始角
			上图中,从X反方向是开始,按顺时针方向增加,实际运转方向也为顺时针方向. lms111:正放时:数据按逆时针依次输出.(起始----->结束) 北阳:正放时:数据按逆时针依次输出 
- HDU 4349 Xiao Ming's Hope 找规律
			原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=4349 Xiao Ming's Hope Time Limit: 2000/1000 MS (Java/ ... 
- Linux内核源码分析--内核启动之zImage自解压过程
			参考: http://blog.chinaunix.net/uid-20543672-id-3018233.html Linux内核编译流程分析 linux2.6内核启动分析--李枝果(不看是你的损失 ... 
- Opencv 改进的外接矩形合并拼接方法
			上一篇中的方法存在的问题是矩形框不够精确,而且效果不能达到要求 这里使用凸包检测的方法,并将原来膨胀系数由20缩小到5,达到了更好的效果 效果图: 效果图: 代码: #include <open ... 
