uva 1398 - Meteor
来源:互联网 发布:php时间函数date() 编辑:程序博客网 时间:2024/06/09 13:02
题目链接:
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=460&page=show_problem&problem=4144
先存代码,睡觉去了
代码:
#include<iostream>#include<cstdio>#include<algorithm>#include<cctype>using namespace std;const int LCM = 2520;const int MAXN = 100010;int w, h, n, idx;inline bool getTime(int x, int y, int& a, int& b){ int tx1, tx2, ty1, ty2; if(a){ tx1 = (w-x)*LCM/a, tx2 = (-x)*LCM/a; if(tx1<0 && tx2<0) return false; } else{ if(x>=w || x<=0) return false; tx1 = 0, tx2 = 1e9; } if(b){ ty1 = (h-y)*LCM/b, ty2 = (-y)*LCM/b; if(ty1<0 && ty2<0) return false; } else{ if(y>=h || y<=0) return false; ty1 = 0, ty2 = 1e9; } if(tx1 > tx2) swap(tx1, tx2); if(ty1 > ty2) swap(ty1, ty2); if(tx1<0) tx1=0; if(ty1<0) ty1=0; a = max(tx1, ty1); b = min(tx2, ty2); return a<b;}struct Node{ int pos; int type; bool operator<(const Node&rhs)const{ if(pos != rhs.pos) return pos<rhs.pos; return type<rhs.type; }}arr[MAXN*2];int main(){ int nCase; scanf("%d", &nCase); while(nCase--){ int x,y,a,b; scanf("%d%d%d",&w,&h,&n); idx = 0; for(int i=0; i<n; ++i){ scanf("%d%d%d%d",&x,&y,&a,&b); if(getTime(x, y, a, b)){ arr[idx].pos = a; arr[idx++].type = 1; arr[idx].pos = b; arr[idx++].type = -1; } } sort(arr, arr+idx); int cur=0, maxx=0; for(int i=0; i<idx; ++i){ if(arr[i].type>0) maxx = max(++cur, maxx); else --cur; } printf("%d\n", maxx); } return 0;}
- uva 1398 - Meteor
- uva 1398 - Meteor
- UVA 1398 - Meteor
- UVA 1398 - Meteor
- UVA之1398 - Meteor
- UVA 1398 Meteor
- Uva---1398Meteor
- UVA - 1398 Meteor
- uva 1398 - Meteor 模拟 99
- uva 1398 - Meteor(贪心)
- UVA 1398 Meteor(扫描线)
- Uva-Live 3905-Meteor
- Seoul 2007 / UVa 1398 Meteor (排序&线性扫描)
- UVA 1398 - Meteor(排序+扫描方法+几何)
- UVa 1398 Meteor 解题报告(扫描线)
- meteor
- meteor
- Meteor
- android获取短信中心号
- WITH CASCADED CHECK OPTION 的用法 ----经典案例
- java常见的一些定义
- 黑马程序员java学习笔记,反射及动态代理
- function函数的length属性
- uva 1398 - Meteor
- C++头文件定义格式_避免重包含
- 一、迭代式mapreduce(顺序链接)
- emacs感悟
- SetLocalIP
- C语言结构体的字节对齐原则
- 应该知道的Linux技巧
- Visual SVN服务器无法启动
- doGet方法中出现的中文乱码问题解决