2013年5月10日
摘要: 链接:http://poj.org/problem?id=2398题意:题意和2318差不多,最后要求球数相同的盒子数。思路:输入的隔板不是按顺序的,所以先对隔板进行排序,最后统计。#include//#include#include#include#includeusing namespace std;const int maxn=1000+5;int n,m,x1,y1,x2,y2;struct Line{ int upp,low;} line[maxn];int cmp(Line l1,Line l2){ //return l2.upp-l1.upp; if(l1.up... 阅读全文
posted @ 2013-05-10 09:49 ∑求和 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 链接:http://poj.org/problem?id=2398题意:有n个隔板,形成n+1个格子,求每个格子中的玩具数。思路:对于每个玩具,二分求它在哪个格子。用叉积判断点是在直线的左边还是右边。#include//#include#include#includeusing namespace std;const int maxn=5000+5;int n,m,x1,y1,x2,y2;struct Line{ int upp,low;}line[maxn];int toy[maxn];int isleft(int x,int y,Line l){ if(x<l.low+(y-y... 阅读全文
posted @ 2013-05-10 09:39 ∑求和 阅读(146) 评论(0) 推荐(0) 编辑
摘要: #includde#include#includeusing namespace std;const int manx=100;struct ArcNode//边结点{ int adjvex;//有向边的另一个邻接点的序号 ArcNode *nextarc;//指向下一个边结点的指针};struct VNode//顶点{ int data;//顶点信息 ArcNode *head1;//出边表表头指针 ArcNode *head2;//入边表表头指针};struct LGraph//图的邻接表存储结构{ VNode vertexs[maxn];//顶点数组 ... 阅读全文
posted @ 2013-05-10 00:04 ∑求和 阅读(206) 评论(0) 推荐(0) 编辑