码迷,mamicode.com
首页 >  
搜索关键字:buy tickets    ( 1402个结果
Leetcode 332: Reconstruct Itinerary
Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tick ...
分类:其他好文   时间:2017-12-10 14:25:21    阅读次数:173
多线程13--多线程并发购票--低效的线程安全的车票容器
1. final List<String> synchronizedList = Collections.synchronizedList(tickets);//list变成线程安全的 1 public class Tickets { 2 public static void main(String ...
分类:编程语言   时间:2017-12-01 23:37:31    阅读次数:190
Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0 - Round 2) E. Buy Low Sell High [贪心 II][数据结构 I]
题目:http://codeforces.com/contest/867/problem/E 题意:模拟股票操作,每天只能买一只股票或者卖一只股票或者什么也不做,求最大利润。 题解:仔细想想是非常简单的一个贪心问题,理解为连续的多次贪心买入卖出可以合并为一次的买入卖出,且值为最优。只需要用一个最小堆 ...
分类:数据库   时间:2017-11-28 18:47:37    阅读次数:185
Buy Tickets(线段树单点更新,逆向思维)
题目大意:有n个的排队,每一个人都有一个val来对应,每一个后来人都会插入当前队伍的某一个位置pos。要求把队伍最后的状态输出。 个人心得:哈哈,用链表写了下,果不其然超时了,后面转念一想要用静态数组思维, 还是炸了。大牛们很给力,逆向一转,真是服气。 一想是呀,转过来的话那么此时的人必然可以得到他 ...
分类:其他好文   时间:2017-11-27 23:28:52    阅读次数:179
[leetcode] 714. Best Time to Buy and Sell Stock with Transaction Fee
Your are given an array of integers prices, for which the i-th element is the price of a given stock on day i; and a non-negative integer fee represen ...
分类:其他好文   时间:2017-11-25 00:52:44    阅读次数:129
leetCode-Best Time to Buy and Sell Stock II
leetCode-Best Time to Buy and Sell Stock II ...
分类:其他好文   时间:2017-11-23 08:13:14    阅读次数:133
[poj] 2828 Buy Tickets
"原题" 简单的线段树问题~ 首先,最后一个人的位置是准确的,而每个人的位置就是倒着推时当前没填的人的该位置(可想而知),所以只要维护现在区间里还没被填的有多少个就可以了! cpp include define N 200010 using namespace std; int n,pos[N],n ...
分类:其他好文   时间:2017-11-22 22:06:31    阅读次数:217
Linux定时任务深入学习
为当前用户创建cron服务 1. 键入 crontab -e 编辑crontab服务文件 例如 文件内容如下: */2 * * * * /bin/sh /home/admin/jiaoben/buy/deleteFile.sh 保存文件并并退出 */2 * * * * /bin/sh /home/a ...
分类:系统相关   时间:2017-11-22 15:16:02    阅读次数:282
POJ 2828 Buy Tickets | 线段树的喵用
题意: 给你n次插队操作,每次两个数,pos,w,意为在pos后插入一个权值为w的数; 最后输出1~n的权值 题解: 首先可以发现,最后一次插入的位置是准确的位置 所以这个就变成了若干个子问题, 所以用线段树维护一下每个区间剩余多少位置可选 对于一个pos 如果左儿子的剩余超过当前位置,就递归进左子 ...
分类:其他好文   时间:2017-11-20 16:11:13    阅读次数:178
Leetcode 122: Best Time to Buy and Sell Stock II
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-11-20 14:35:09    阅读次数:83
1402条   上一页 1 ... 28 29 30 31 32 ... 141 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!