class Solution { public: int maxProfit(vector& prices) { int local=0,golal = 0; for (int i=0; i<prices.size()-1; i++) { local = ma... ...
分类:
其他好文 时间:
2017-10-12 01:02:17
阅读次数:
110
Buy Tickets Problem Description Railway tickets were difficult to buy around the Lunar New Year in China, so we must get up early and join a long queu ...
分类:
其他好文 时间:
2017-10-06 17:33:57
阅读次数:
168
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1260 Tickets Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tota ...
分类:
其他好文 时间:
2017-10-03 22:18:32
阅读次数:
164
121. Best Time to Buy and Sell Stock【easy】 Say you have an array for which the ith element is the price of a given stock on day i. If you were only pe ...
分类:
其他好文 时间:
2017-10-03 16:55:06
阅读次数:
202
1092. To Buy or Not to Buy (20) 时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue 时间限制 100 ms 时间限制 100 ms 内存限制 65536 kB 内存限制 65536 k ...
分类:
其他好文 时间:
2017-10-03 00:50:11
阅读次数:
199
题目大意: 一些人要排队,开始时队为空 给定一些数对 表示这些人的状态 这些人按数对的顺序准备入队 其中每个数对第一个数a表示这个人来的时候站在当前队伍中a个人的后面,a=0时站在队伍最前面 第二个数b表示这个人的编号 求最终队伍的顺序,即依次输出他们的编号 思路: 首先可知最后一个人进入时 数对的 ...
分类:
其他好文 时间:
2017-10-02 13:27:13
阅读次数:
163
【题意】已知n天股价,每天可以买入一股或卖出一股或不作为,最后必须持0股,求最大收益。 【算法】堆 贪心? 【题解】 不作为思想:【不作为=买入再卖出】 根据不作为思想,可以推出中转站思想。 中转站思想:【买卖可以借助中转站,差值累加】 做法:从左到右,每次将两个-v加入堆,然后取大堆顶出来组成买卖 ...
分类:
其他好文 时间:
2017-10-01 13:12:55
阅读次数:
212
Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple ...
分类:
其他好文 时间:
2017-09-29 13:19:50
阅读次数:
140
Basedonourunderstanding,heremaybeofficiallysaid,2017OSRSDeadman
winterseasonbeganat5pmhours.UTConSept23rd.Thismeansthatyoucould
participateinRuneFest2017inacoupleofhours.Ifyouareanewcomerto
OldSchoolRunescapeGoldpassingawaypatterns,youneedmoreinfo.Inorderto..
分类:
其他好文 时间:
2017-09-25 11:52:49
阅读次数:
116