ZOJ 3699 Dakar Rally(贪心)】的更多相关文章

Dakar Rally Time Limit: 2 Seconds      Memory Limit: 65536 KB Description The Dakar Rally is an annual Dakar Series rally raid type of off-road race, organized by the Amaury Sport Organization. The off-road endurance race consists of a series of rout…
这是一道贪心题,他的贪心思想很容易想明白,我们保证油箱里的油始终是最便宜的我们最后的花费就能是最少的.实现方法就是:比如现在在i点,我们看邮箱满载能最远到达哪里,不妨设最远到达j,(j >= i + 1),注意此处的达到,只是指能够到达这个路段的开头位置,并不是走完这段路...所以我们到达j点会有一个leave剩余,leave >= 0,但是在i 和 j点之间我们只需要到达第一个油价比i点小的路段开头位置,换上新油就可以了,之所以是第一个,是因为题目要求必须从前往后按顺序走,不妨设中间有没有出…
题目链接: PKU:http://poj.org/problem?id=1862 ZJU:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=543 Description Our chemical biologists have invented a new very useful form of life called stripies (in fact, they were first called in Russian -…
Numbers Time Limit: 2 Seconds      Memory Limit: 65536 KB DreamGrid has a nonnegative integer n . He would like to divide n into m nonnegative integers a1,a2,...am and minimizes their bitwise or (i.e.a1+a2+...+am=n  and a1 OR a2 OR a3...OR am should…
贪心.能凑成一组就算一组 Unrhymable Rhymes Time Limit: 10 Seconds      Memory Limit: 32768 KB      Special Judge An amateur poet Willy is going to write his first abstract poem. Since abstract art does not give much care to the meaning of the poem, Willy is plan…
题目链接: http://www.icpc.moe/onlinejudge/showProblem.do?problemCode=3946 题解: 用dijkstra跑单元最短路径,如果对于顶点v,存在一系列边(ui,v)使得dis[v]最小(dis[v]表示0到v的距离).这些边能且只能选一条,那么我们自然应该选cost最小的那个边了. #include<iostream> #include<cstdio> #include<cstring> #include<…
Optiver sponsored problem. After years of hard work Optiver has developed a mathematical model that allows them to predict wether or not a company will be succesful. This obviously gives them a great advantage on the stock market. In the past, Optive…
Pass-Muraille Time Limit: 2 Seconds      Memory Limit: 65536 KB In modern day magic shows, passing through walls is very popular in which a magician performer passes through several walls in a predesigned stage show. The wall-passer (Pass-Muraille) h…
Arctic Network The Department of National Defence (DND) wishes to connect several northern outposts by a wireless network. Two different communication technologies are to be used in establishing the network: every outpost will have a radio transceive…
                                                B - Team Formation Description For an upcoming programming contest, Edward, the headmaster of Marjar University, is forming a two-man team from N students of his university. Edward knows the skill level…