码迷,mamicode.com
首页 >  
搜索关键字:josephs problem    ( 37568个结果
poj 1724 ROADS
http://poj.org/problem?id=1724这道题我使用的是dijkstra,在处理进队列是条件是if(st2.c+c1 2 #include 3 #include 4 #include 5 #define maxn 20000 6 using namespace std; 7...
分类:其他好文   时间:2014-06-11 08:28:15    阅读次数:177
贪心 序列
题目:http://icpc.ahu.edu.cn/OJ/Problem.aspx?id=517之前差分约束搞了一发,现在终于知道贪心了。对区间右端点排序,尽量从右端点取数。 数据比较小,n^2就行了。#include #include #include #include #include #inc...
分类:其他好文   时间:2014-06-11 08:21:10    阅读次数:276
贪心Poj1328
题目:http://poj.org/problem?id=1328注意 输出 Case :这里是有个空格的。。和之前序列想法差不多 尽可能 向一边贪心。#include #include #include #include #include #include #include #include #i...
分类:其他好文   时间:2014-06-11 08:00:13    阅读次数:252
HLG 1564 螺旋矩阵 (趣味C语言)
链接: http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1564 Description 对于给定的一个数n,要你打印n*n的螺旋矩阵。 比如n=3时,输出: 1 2 3 8 9 4 7 6 5 Input 多组测试数据,每个测试数据包含一个整数n(1 Outpu...
分类:编程语言   时间:2014-06-09 23:23:32    阅读次数:322
Python笔记-Grouping Records Together Based on a Field
Grouping Records Together Based on a Field Problem You have a sequence of dictionaries or instances and you want to iterate over the data in groups based on the value of a...
分类:编程语言   时间:2014-06-08 18:22:29    阅读次数:280
HLG 1584 青蛙过河 (二分)
链接: http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1584 Description 青蛙王国一年一度的游戏又开始了,这个游戏要求青蛙必须跳过河。河的宽度是 L 。河里有n块石头,这n块石头从河的一边笔直的连到另一边。青蛙只能踩着石头过河,如果它们掉到水里,将被淘汰出局。游戏规定青蛙最...
分类:其他好文   时间:2014-06-08 17:52:04    阅读次数:178
NOIP2005提高组 && HLG 1219 谁拿了最多奖学金 (好经典的基础题 )
链接: http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=1219 Description 某校的惯例是在每学期的期末考试之后发放奖学金。发放的奖学金共有五种,获取的条件各自不同: 1) 院士奖学金,每人8000元,期末平均成绩高于80分(>80),并且在本学期内发表1篇或1篇以上论文...
分类:其他好文   时间:2014-06-08 17:51:19    阅读次数:268
POJ 1328 Radar Installation(贪心)
题目链接:http://poj.org/problem?id=1328 题目大意是在直线海岸线周围有小岛,建设雷达把小岛覆盖,但是雷达有直径,要求建造最少的雷达。 很明显就是一个贪心,就这题困了两天; 刚开始我是打算,先按照X坐标以小到大,Y坐标以大到小排序,然后从最左上的小到开始,以每个小岛为圆心,d(雷达半径)为半径画圆,求出与海岸线交点然后以最右边的交点建雷达,然后向右遍历,如果在雷达...
分类:其他好文   时间:2014-06-08 15:30:52    阅读次数:221
poj 1724 ROADS(dfs)
http://poj.org/problem?id=1724 大致题意:N个城市由R条单向路连通,每条路(S,D)之间有两个因素:路的长度L和路的花费T。现要从城市1到达城市N,求花费在K以内的最短路程。 思路:很明显的dfs(他们都说很明显的spfa。。。)。不过dfs有几点注意的地方: 建立邻接表不能用vector存,要用链表的形式,采用头插法。 dfs的时候,在递归节...
分类:其他好文   时间:2014-06-08 14:41:32    阅读次数:243
字典树 Trie (HDU 1671)
Problem Description Given a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let’s say the phone catalogue listed these numbers: 1. Emergenc...
分类:其他好文   时间:2014-06-08 10:31:22    阅读次数:234
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!