百度之星复赛第一题。不明白这么水的题为何一堆人没过。。。这些人是咋晋级复赛的呢。。。

/*
* 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简单枚举的更多相关文章

  1. UVA - 10167 - Birthday Cake (简单枚举)

    思路:简单枚举 AC代码: #include <cstdio> #include <cstring> #include <iostream> #include &l ...

  2. Java练习 SDUT-1959_简单枚举类型——植物与颜色

    简单枚举类型--植物与颜色 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 请定义具有red, orange, yell ...

  3. hdu5073 简单枚举+精度处理

    其实这题还是挺简单的,因为移动k个星球后,这k个星球的权值就可以变为0,所以只有剩下的本来就是连着的才是最优解,也就是说要动也是动两端的,那么就O(N)枚举一遍动哪些就好了. 我是在杭电oj题目重现的 ...

  4. zoj 1622 Switch 开关灯 简单枚举

    ZOJ Problem Set - 1622 Switch Time Limit: 2 Seconds      Memory Limit: 65536 KB There are N lights i ...

  5. UVa 725 简单枚举+整数转换为字符串

    Division  Write a program that finds and displays all pairs of 5-digit numbers that between them use ...

  6. UVA 725 UVA 10976 简单枚举

    UVA 725 题意:0~9十个数组成两个5位数(或0开头的四位数),要求两数之商等于输入的数据n.abcde/fghij=n. 思路:暴力枚举,枚举fghij的情况算出abcde判断是否符合题目条件 ...

  7. 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 ...

  8. C#枚举的简单使用

    枚举这个名词大家都听过,很多小伙伴也使用过, 那么枚举在开发中能做什么,使用它后能给程序代码带来什么改变,为什么用枚举. 各位看官且坐下,听我一一道来. 为什么使用枚举? 1.枚举能够使代码更加清晰, ...

  9. 做 fzu oj 1003 简单的枚举

    暴力求解法---简单枚举 定义一个函数(函数的内容大概是包含了题目所给的限制条件),然后主函数就是通过循环进行枚举,枚举出可能的元素,带入函数中进行验证,如果符合函数所给的情况,则为其解.

随机推荐

  1. Win32 绘制RGB三原色图案

    以前看到三原色的图案,一直很好奇是如何画出来.后来终于搞清楚了,其实很简单,实际上就是RGB三个分量的"位与"运算. 下面给出Win32绘制三原色图案的例子,特此记录在此: #in ...

  2. Struts2的上传与下载

    转自:http://blog.csdn.net/Mark_LQ/article/details/49822821 10.1.1 文件上传基本案例   第一步:上传组件依赖与commons-fileup ...

  3. sql server 2008导入和导出sql文件

    导出表数据和表结构sql文件 在日常的开发过程中,经常需要导出某个数据库中,某些表数据:或者,需要对某个表的结构,数据进行修改的时候,就需要在数据库中导出表的sql结构,包括该表的建表语句和数据存储语 ...

  4. hdu 4503(数学,概率)

    湫湫系列故事——植树节 Time Limit: 1000/500 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total ...

  5. Network | DHCP

    动态主机设置协议(Dynamic Host Configuration Protocol, DHCP)是一个局域网的网络协议,使用UDP协议工作,主要有两个用途: 给内部网络或网络服务供应商自动分配I ...

  6. jquery图片左右来回循环飘动

    $(function () { function left_right() { $("#sc1452").animate({'left':'-=100'},5000).delay( ...

  7. eclipse默认配色(内含恢复文件和恢复方法)

    转载:http://blog.csdn.net/w174504744/article/details/8672679 很多搞开发的同学一开始不喜欢默认的eclipse白底配色,去网上千辛万苦搜到了很多 ...

  8. 【java】google的zxing架包生成二维码和读取二维码【可带文字和logo】

    承接RC4生成不重复字符串的需求之后,因为优惠码要方便用户使用的缘故,所以思来想去,觉得还是直接生成二维码给用户直接扫比较实用,也不用用户专门记录冗长的优惠码编号. ================= ...

  9. WCF中常用的binding方式 z

    WCF中常用的binding方式: BasicHttpBinding: 用于把 WCF 服务当作 ASMX Web 服务.用于兼容旧的Web ASMX 服务. WSHttpBinding: 比 Bas ...

  10. vue Syntax Error: Unexpected token {

    > music@1.0.0 dev F:\music\music> node build/dev-server.js > Starting dev server...ERROR Fa ...