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

/*
* 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. UVa11424 GCD - Extreme (I)

    直接两重循环O(n^2)算gcd……未免太耗时 枚举因数a和a的倍数n,考虑gcd(i,n)==a的i数量(i<=n) 由于gcd(i,n)==a等价于gcd(i/a,n/a)==1,所以满足g ...

  2. How to debug Android Native Application with eclipse

    This blog is inspired by this tutorial http://mhandroid.wordpress.com/2011/01/23/using-eclipse-for-a ...

  3. idea http请求的插件(测试接口方便)

    http://blog.csdn.net/winter_chen001/article/details/77249029

  4. MYSQL无法连接,提示10055错误尝试解决

    解决方法:(以下内容为本人亲自实践原创)总结一下,应该是连接数的问题,那么服务器上有些什么连接数:1.IIS网站服务器中各个网站中有“连接超时时间”,“会话超时时间”:2.其它程序占用的服务器连接数( ...

  5. Codeforces Gym101502 H.Eyad and Math-换底公式

    H. Eyad and Math   time limit per test 2.0 s memory limit per test 256 MB input standard input outpu ...

  6. 精读《Function Component 入门》

    1. 引言 如果你在使用 React 16,可以尝试 Function Component 风格,享受更大的灵活性.但在尝试之前,最好先阅读本文,对 Function Component 的思维模式有 ...

  7. Netty中NioEventLoopGroup的创建源码分析

    NioEventLoopGroup的无参构造: public NioEventLoopGroup() { this(0); } 调用了单参的构造: public NioEventLoopGroup(i ...

  8. 【UTR #2】题目排列顺序

    题目描述 "又要出题了." 宇宙出题中心主任 -- 吉米多出题斯基,坐在办公桌前策划即将到来的 UOI. 这场比赛有 $n$ 道题,吉米多出题斯基需要决定这些题目的难度,然后再在汪 ...

  9. 第5章 Spring Boot 功能

    Spring Boot 功能 本节将会介绍Spring Boot的一些细节. 在这里,您可以了解您将要使用和自定义的主要功能. 如果还没有准备好,您可能需要阅读第二部分“入门指南”和第三部分“使用 S ...

  10. xamarin.IOS App闪退日志----crash

    一.查找日志文件位置:通过xcode/windows/device/你的IPhone/crash 二.拿到日志可以直接查看,但是日志记录太乱看不懂,需要转换处理,查找.DSYM文件,文件位置:/Use ...