上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页

2014年1月27日

uva 11997 优先队列

摘要: K Smallest SumsYou're given k arrays, each array has k integers. There are kkways to pick exactly one element in each array and calculate the sum of the integers. Your task is to find the k smallest sums among them.InputThere will be several test cases. The first line of each case contains an in 阅读全文

posted @ 2014-01-27 13:53 雄.. 阅读(219) 评论(0) 推荐(0)

LA 3135 优先队列

摘要: 题目大意:有若干命令,它有两个属性Q_Num,Period(周期)。按时间循序模拟前k个命令并输出他们的Q_Num,若同时发生输出Q_Num最小的值。#include#include#include#includeusing namespace std;struct Item{ int QNum,Period,Time; bool operator pq; while(scanf("%s",s) && s[0] != '#') { scanf("%d %d",&item.QNum,&item.Period) 阅读全文

posted @ 2014-01-27 11:54 雄.. 阅读(247) 评论(0) 推荐(0)

uva 11991 查询中容器的运用

摘要: 题目大意:一个n个整数的数组,m条查询指令。(1#include#include#includeusing namespace std;map > a;int main(){ int n,m,i,p,k,v; while(scanf("%d %d",&n,&m) == 2) { a.clear(); for(i=0;i (); a[p].push_back(i+1); } while(m--) { scanf("%d %d",&k,&v); ... 阅读全文

posted @ 2014-01-27 11:07 雄.. 阅读(163) 评论(0) 推荐(0)

2014年1月26日

uva 11995 判别数据类型

摘要: Problem II Can Guess the Data Structure!There is a bag-like data structure, supporting two operations:1 xThrow an element x into the bag.2Take out an element from the bag.Given a sequence of operations with return values, you're going to guess the data structure. It is a stack (Last-In, First-Ou 阅读全文

posted @ 2014-01-26 13:49 雄.. 阅读(653) 评论(1) 推荐(0)

2013年11月24日

LA 4973异面线段

摘要: 题目大意:给两条线段求他们间的最小距离的平方(以分数形式输出)。贴个模版吧!太抽象了。#include#include#includeusing namespace std;struct Point3 { int x, y, z; Point3(int x=0, int y=0, int z=0):x(x),y(y),z(z) { }};typedef Point3 Vector3;Vector3 operator + (const Vector3& A, const Vector3& B) { return Vector3(A.x+B.x, A.y+B.y, A.z+B.z) 阅读全文

posted @ 2013-11-24 20:04 雄.. 阅读(238) 评论(0) 推荐(0)

2013年11月19日

LA 2797 平面区域dfs

摘要: 题目大意:一个平面区域有n条线段,问能否从(0,0)处到达无穷远处(不穿过任何线段)分析:若两条线段有一个端点重合,这种情况是不能从端点重合处穿过的 的。因此对每个端点延长一点,就可以避免这个问题。n*2个端点加上起始点跟终点,两两之间不穿过任何线段的为可行路径建图。最后以(0,0)开始dfs,看能否到达无穷远点。#include#include#include#include#include#includeusing namespace std;const double eps = 1e-12;double dcmp(double x) { if(fabs(x) vertices; ver. 阅读全文

posted @ 2013-11-19 20:00 雄.. 阅读(215) 评论(0) 推荐(0)

2013年11月18日

LA 2218 半平面交

摘要: 题目大意:n名选手参加铁人三项赛,比赛按照选手在三个赛段中所用的总时间排定名次。已知每名选手在三个项目中的速度Ui、Vi、Wi。问对于选手i,能否通过适当的安排三个赛段的长度(但每个赛段的长度都不能为0),来保证他获胜。分析:假设三个赛段的长度分别为x、y、z,则选手i获胜的充要条件就是:x/vi+y/ui+(1-x-y)/wi0本题就转化为求这n-1个不等式对应的半平面的交,加上x>0,y>0,1-x-y>0这三个约束,并判断其面积是否大于0(即排除空集、点、线的情况)。#include#include#include#includeusing namespace std; 阅读全文

posted @ 2013-11-18 22:06 雄.. 阅读(222) 评论(0) 推荐(0)

poj 3525 求凸包的最大内切圆

摘要: Most Distant Point from the SeaTime Limit:5000MSMemory Limit:65536KTotal Submissions:3640Accepted:1683Special JudgeDescriptionThe main land of Japan called Honshu is an island surrounded by the sea. In such an island, it is natural to ask a question: “Where is the most distant point from the sea?” T 阅读全文

posted @ 2013-11-18 20:59 雄.. 阅读(766) 评论(0) 推荐(0)

2013年11月13日

poj 1031 多边形对点(向周围发射光线)的覆盖

摘要: FenceTime Limit:1000MSMemory Limit:10000KTotal Submissions:3018Accepted:1010DescriptionThere is an area bounded by a fence on some flat field. The fence has the height h and in the plane projection it has a form of a closed polygonal line (without self-intersections), which is specified by Cartesian 阅读全文

posted @ 2013-11-13 22:34 雄.. 阅读(511) 评论(0) 推荐(0)

poj 1269 直线间的关系

摘要: Intersecting LinesTime Limit:1000MSMemory Limit:10000KTotal Submissions:9360Accepted:4210DescriptionWe all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel, 2) intersect 阅读全文

posted @ 2013-11-13 19:10 雄.. 阅读(185) 评论(0) 推荐(0)

上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页

导航