Best Time to Buy and Sell Stock IIISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the...
分类:
其他好文 时间:
2014-10-26 22:43:56
阅读次数:
178
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2126题意:给你n个物品,m元钱,问你最多能买个多少物品,并且有多少种解决方案。一开始想到的是,先解决给m元钱因为我花的钱少就一定能购买够多的物品,因此是个贪心算法。记买最多的物品数为c。然后就是设计状态...
分类:
其他好文 时间:
2014-10-24 01:34:06
阅读次数:
210
Problem Description
Good news for us: to release the financial pressure, the government started selling galaxies and we can buy them from now on! The first one who bought a galaxy was Tianming Yun an...
分类:
其他好文 时间:
2014-10-23 22:51:27
阅读次数:
228
Language:
Default
Buy Tickets
Time Limit: 4000MS
Memory Limit: 65536K
Total Submissions: 13847
Accepted: 6926
Description
Railway tickets were difficult to buy ar...
分类:
其他好文 时间:
2014-10-23 22:49:24
阅读次数:
299
Best Time to Buy and Sell Stock IISay you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the ...
分类:
其他好文 时间:
2014-10-23 12:23:23
阅读次数:
224
Best Time to Buy and Sell StockSay you have an array for which theithelement is the price of a given stock on dayi.If you were only permitted to compl...
分类:
其他好文 时间:
2014-10-22 21:54:00
阅读次数:
192
课程要求在Myeclipse上做各种实验,当把各种插件安好以后,突然Myeclipse提示使用到期,你可知道按那些个插件收了多少挫折么,怎能刚安好就用不了,但是又不想buy,所以就上网找破解咯,其中发现这个教程http://jingyan.baidu.com/article/7082dc1c57eb19e40a89bdcd.html
写的不错,跟着安就行;
工具:
但是他提供的工具就有点坑了...
分类:
系统相关 时间:
2014-10-19 23:21:26
阅读次数:
233
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-10-19 22:35:19
阅读次数:
165
知道是求连续最大子数组后就简单了。但是注意边界条件,如果最大子数组之和<0,那就不要交易了, 返回0.
public class Solution {
public int maxProfit(int[] prices) {
if(prices.length < 2)
return 0;
int n = prices....
分类:
其他好文 时间:
2014-10-19 00:06:49
阅读次数:
146
明白了上一题是求最大的连续子数组之和后,这题就更加简单了,遇到小于0的就不要加。
public class Solution {
public int maxProfit(int[] prices) {
if(prices.length < 2)
return 0;
int n = prices.length;
...
分类:
其他好文 时间:
2014-10-19 00:05:52
阅读次数:
194