HDU 5258(水暴力)
2015-06-12 18:19
239 查看
题意 :中文题 不描述了 暴力四条边。
代码:
代码:
#include<stdio.h> struct Node { int x1, y1, x2, y2; }cunh[26], cuns[25]; int Max(int a, int b) { if(a > b) return a; return b; } int Min(int a, int b) { if(a < b) return a; return b; } int ok(int i, int j) { if(cuns[i].x1 > cunh[j].x2 || cuns[i].x2 < cunh[j].x1)return 0; if(cuns[i].y1 > cunh[j].y2 || cuns[i].y2 < cunh[j].y1)return 0; return 1; } int main() { int T, n, x1, x2, y1, y2, t, coun = 1; scanf("%d", &T); while(T--) { scanf("%d", &n); int cnt, tot; cnt = tot = 0; for(int i = 1; i <= n; i++) { scanf("%d %d %d %d", &x1, &y1, &x2, &y2); if(x1 == x2) { if(y1 > y2) t = y1, y1 = y2, y2 = t; cunh[tot].x1 = x1, cunh[tot].x2 = x2, cunh[tot].y1 = y1, cunh[tot++].y2 = y2; } if(y1 == y2) { if(x1 > x2) t = x1, x1 = x2, x2 = t; cuns[cnt].x1 = x1, cuns[cnt].x2 = x2, cuns[cnt].y1 = y1, cuns[cnt++].y2 = y2; } } __int64 num = 0; for(int i = 0; i < cnt; i++) for(int j = i+1; j < cnt; j++) for(int k = 0; k < tot; k ++) for(int p = k+1; p < tot; p++) { if(ok(i, k) && ok(i, p) && ok(j, k) && ok(j, p)) num ++; } printf("Case #%d:\n", coun ++); printf("%I64d\n", num); } }
相关文章推荐
- rpm包下载地址 ftp://rpmfind.net/linux/
- 10-12
- mock.js 生成假数据 前端独立于后台开发
- Eclipse中如何将Java项目转换为WEB项目
- hdu 5265(水)
- windows下 创建SVN仓库的步骤
- IOS 需要学习的地方
- 恶补jquery(四)jquery中事件--冒泡
- 阅读10,11,12章
- 【剑指offer】面试题四:替换空格
- iBokan_ios80_自学系列_1(循环结构初练)
- HTML5 Drag and Drop
- C++模板实现事件处理器中的“通用成员函数指针”的调用(三)
- [leetcode] Invert Binary Tree
- XA中使用dblink发现的一个oracle bug
- 树的前序,中序,后序遍历(递归)
- 将博客搬至CSDN
- hiho 小Hi小Ho的惊天大作战:扫雷·一 扫雷·三
- 在Android studio 中配置高德地图api后显示地图遇到的问题
- git使用