随笔分类 -  贪心

ACM学习历程—HihoCoder1309任务分配(排序 && 贪心)
摘要:http://hihocoder.com/problemset/problem/1309 题目大意是给定n个任务的起始时间,求问最少需要多少台机器。 有一个贪心的策略就是,如果说对于一个任务结束,必然接一个开始时间最接近这个的比较合算。我们假想一个任务池,那么任务池中最早结束的那个,必然接剩余任务中 阅读全文

posted @ 2016-06-04 21:42 AndyQsmart 阅读(882) 评论(0) 推荐(0)

ACM学习历程—TopCoder SRM691 Div2
摘要:这是我的第一次打TC,感觉打的一般般吧。不过TC的题目确实挺有意思的。 由于是用客户端打的,所以就不发题目地址了。 300分的题: 这题大意是有一段序列只包含+和数字0~9。 一段序列的操作是,从头扫到尾,遇到+就对计数器+1。遇到数字就计算abs(num-count)的值,并加到sum中。 题目要 阅读全文

posted @ 2016-05-31 17:12 AndyQsmart 阅读(601) 评论(0) 推荐(0)

ACM学习历程—Codeforces Round #354 (Div. 2)
摘要:http://codeforces.com/contest/676 在allzysyz学弟和hqwhqwhq的邀请下,打了我的第三场CF。。。 毕竟在半夜。。所以本来想水到12点就去睡觉的。。。结果一下次过了三题,发现第四题是个bfs,就打到了12:30.。。。BC貌似是没有了,不知道后面还会不会有 阅读全文

posted @ 2016-05-26 13:25 AndyQsmart 阅读(280) 评论(0) 推荐(0)

ACM学习历程—广东工业大学2016校赛决赛-网络赛D 二叉树的中序遍历(数据结构)
摘要:题目链接:http://gdutcode.sinaapp.com/problem.php?cid=1031&pid=3 这算是一个胡搞类型的题目。当然肯定是有其数据结构支撑的。 唯一的限制就是不能出现连续的两个’#’。 因为如果我从左到右构造这棵树,那么假设我构造到第i个, 如果i+1是数字,那么把 阅读全文

posted @ 2016-04-10 20:02 AndyQsmart 阅读(281) 评论(0) 推荐(0)

ACM学习历程—UVALive 7147 World Cup(分类讨论 && 贪心)
摘要:题目链接:https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5159题目大意是就是n个人进行两两的比赛,胜一局得A分,平局B分,败局C分。然后取... 阅读全文

posted @ 2015-12-07 19:58 AndyQsmart 阅读(549) 评论(0) 推荐(0)

ACM学习历程—HDU 5536 Chip Factory(xor && 字典树)
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5536题目大意是给了一个序列,求(si+sj)^sk的最大值。首先n有1000,暴力理论上是不行的。此外题目中说大数据只有10组,小数据最多n只有100。(那么c*n^2的复杂度应该差不多)于是可以考虑枚... 阅读全文

posted @ 2015-11-14 20:43 AndyQsmart 阅读(228) 评论(0) 推荐(0)

ACM学习历程—POJ 3764 The xor-longest Path(xor && 字典树 && 贪心)
摘要:题目链接:http://poj.org/problem?id=3764题目大意是在树上求一条路径,使得xor和最大。由于是在树上,所以两个结点之间应有唯一路径。而xor(u,v)=xor(0,u)^xor(0,v)。所以如果预处理出0结点到所有结点的xor路径和,问题就转换成了求n个数中取出两个数,... 阅读全文

posted @ 2015-11-11 20:22 AndyQsmart 阅读(210) 评论(0) 推荐(0)

ACM学习历程—CSU 1216 异或最大值(xor && 贪心 && 字典树)
摘要:题目链接:http://acm.csu.edu.cn/OnlineJudge/problem.php?id=1216题目大意是给了n个数,然后取出两个数,使得xor值最大。首先暴力枚举是C(n,2),显然不行。考虑每一个数,显然,从最高位开始,如果它能和某一个数xor,让最高位为1,效果肯定是最佳的... 阅读全文

posted @ 2015-11-10 17:40 AndyQsmart 阅读(2330) 评论(0) 推荐(0)

ACM学习历程—FZU2195 检查站点(树形DP || 贪心)
摘要:Description在山上一共有N个站点需要检查,检查员从山顶出发去各个站点进行检查,各个站点间有且仅有一条通路,检查员下山前往站点时比较轻松,而上山时却需要额外的时间,问最后检查员检查完所有站点时所需要的额外时间最少是多少。Input包含多组数据 每组数据输入第一行为一个整数N 表示站点个数(1... 阅读全文

posted @ 2015-09-09 17:42 AndyQsmart 阅读(214) 评论(0) 推荐(0)

ACM学习历程—HDU4415 Assassin’s Creed(贪心)
摘要:Problem DescriptionEzio Auditore is a great master as an assassin. Now he has prowled in the enemies’ base successfully. He finds that the only weapon... 阅读全文

posted @ 2015-09-09 17:11 AndyQsmart 阅读(309) 评论(0) 推荐(0)

ACM学习历程—HDU5422 Rikka with Graph(贪心)
摘要:Problem DescriptionAs we know, Rikka is poor at math. Yuta is worrying about this situation, so he gives Rikka some math tasks to practice. There is o... 阅读全文

posted @ 2015-09-07 17:23 AndyQsmart 阅读(275) 评论(0) 推荐(0)

ACM学习历程—HDU5265 pog loves szh II(策略 && 贪心 && 排序)
摘要:DescriptionPog and Szh are playing games.There is a sequence with $n$ numbers, Pog will choose a number A from the sequence. Szh will choose an anothe... 阅读全文

posted @ 2015-06-09 17:31 AndyQsmart 阅读(283) 评论(0) 推荐(0)

ACM学习历程—FZU 2144 Shooting Game(计算几何 && 贪心 && 排序)
摘要:DescriptionFat brother and Maze are playing a kind of special (hentai) game in the playground. (Maybe it’s the OOXX game which decrypted in the last p... 阅读全文

posted @ 2015-06-01 21:41 AndyQsmart 阅读(294) 评论(0) 推荐(0)

ACM学习历程—HDU 4726 Kia's Calculation( 贪心&&计数排序)
摘要:DescriptionDoctor Ghee is teaching Kia how to calculate the sum of two integers. But Kia is so careless and alway forget to carry a number when the su... 阅读全文

posted @ 2015-05-30 21:36 AndyQsmart 阅读(214) 评论(0) 推荐(0)

ACM学习历程——NOJ1113 Game I(贪心 || 线段树)
摘要:Description尼克发明了这样一个游戏:在一个坐标轴上,有一些圆,这些圆的圆心都在x轴上,现在给定一个x轴上的点,保证该点没有在这些圆内(以及圆上),尼克可以以这个点为圆心做任意大小的圆,他想知道自己做多可以与多少个给定的圆相交(相切也算,包含不算)。Input输入有多组数据 输入到文件尾每一... 阅读全文

posted @ 2015-04-28 17:47 AndyQsmart 阅读(194) 评论(0) 推荐(0)

ACM学习历程——POJ 1700 Crossing River(贪心)
摘要:DescriptionA group of N people wishes to go across a river with only one boat, which can at most carry two persons. Therefore some sort of shuttle arr... 阅读全文

posted @ 2014-11-23 12:14 AndyQsmart 阅读(331) 评论(0) 推荐(0)

ACM学习历程——POJ 2376 Cleaning Shifts(贪心)
摘要:Description Farmer John is assigning some of his N (1 #include #include #include #include #include #include #include #include #include #include #defin... 阅读全文

posted @ 2014-11-23 12:05 AndyQsmart 阅读(261) 评论(0) 推荐(0)

ACM学习历程——HDU 5014 Number Sequence (贪心)(2014西安网赛)
摘要:DescriptionThere is a special number sequence which has n+1 integers. For each number in sequence, we have two rules:● ai∈ [0,n]● ai≠ aj( i ≠ j )For s... 阅读全文

posted @ 2014-11-01 17:24 AndyQsmart 阅读(429) 评论(0) 推荐(0)

导航