九度 题目1437:To Fill or Not to Fill】的更多相关文章

题目描述: With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different gas station may give different price. You are…
题目1437:To Fill or Not to Fill 时间限制:1 秒 内存限制:128 兆 特殊判题:否 提交:1488 解决:345 题目描述: With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way fro…
题目地址:http://ac.jobdu.com/problem.php?pid=1437 题目描述: With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different…
题目描写叙述: With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different gas station may give different price. You ar…
题目大意:小明从杭州去往某目的地,要经过一些加油站,每个加油站的价格不一样.若能顺利到达,求加油费用最少为多少,否则求出能行驶的最远距离. 思路:贪心算法 1>若下一加油站的价格更便宜,则只需走到下一加油站即可. 2>若下一结点的价格没有该节点便宜 1.若将油箱加满,看看在其能到达的最远距离内,是否有比该点更便宜的站点.若有,则正好到达这个跟便宜的点即可:否则,将油箱加满,然后到达这段距离内价格最小的点(除当前点外). 代码如下: #include<cstdio> #include…
转载请注明本文链接http://blog.csdn.net/yangnanhai93/article/details/40658571 题目链接:pid=1044">http://ac.jobdu.com/problem.php?pid=1044 这个题目的分析预计都被写烂了,我这里就简单的说明一下.事实上认为他们写了好多好多非常浅显的东西,希望我的分析可以给大家减轻点负担.尽管我也是看别人的分析之后才更加理解这个题目. 分析例如以下: 已知前序和后序, 1:我们先知道的,肯定是字符串第一…
转载声明本文地址 http://blog.csdn.net/yangnanhai93/article/details/40563285 题目链接:http://ac.jobdu.com/problem.php?pid=1421 这个题目是一个简单的概率题目,说一下思想就好了 由于对于每个人.他须要计算他有多少个女性朋友,同一时候朋友的性别是随机的,概率为0.5.这个题目就相当于算期望了 对每个人来说,他本身是男性的可能性为0.5 ,他有至少m个的概率就仅仅须要在他的朋友FriendsCount中…
http://ac.jobdu.com/problem.php?pid=1203 题目描述: 输入一个ip地址串,判断是否合法. 输入: 输入的第一行包括一个整数n(1<=n<=500),代表下面会出现的IP地址的个数.    接下来的n行每行有一个IP地址,IP地址的形式为a.b.c.d,其中a.b.c.d都是整数. 输出: 可能有多组测试数据,对于每组数据,如果IP地址合法则输出"Yes!”,否则输出"No!”. 样例输入: 2 255.255.255.255 512.…
http://ac.jobdu.com/problem.php?pid=1026 题目描述: 输入两个不超过整型定义的非负10进制整数A和B(<=231-1),输出A+B的m (1 < m <10)进制数. 输入: 输入格式:测试输入包含若干测试用例.每个测试用例占一行,给出m和A,B的值.当m为0时输入结束. 输出: 输出格式:每个测试用例的输出占一行,输出A+B的m进制数. 样例输入: 8 1300 48 2 1 7 0 样例输出: 2504 1000 来源: 2008年浙江大学计算…
http://ac.jobdu.com/problem.php?pid=1195 题目描述: 输入多行字符串,请按照原文本中的顺序输出其中最短和最长的字符串,如果最短和最长的字符串不止一个,请全部输出. 输入: 输入包括多行字符串,字符串的长度len,(1<=len<=1000). 输出: 按照原文本中的顺序输出其中最短和最长的字符串,如果最短和最长的字符串不止一个,请全部输出. 样例输入: hello she sorry he 样例输出: he hello sorry 来源: 2008年华中…