码迷,mamicode.com
首页 >  
搜索关键字:crb and candies    ( 410个结果
POJ 2886 Who Gets the Most Candies?(线段树·约瑟夫环)
题意  n个人顺时针围成一圈玩约瑟夫游戏  每个人手上有一个数val[i]   开始第k个人出队  若val[k] 0 时向左数val[k]个  第m出队的人可以得到m的约数个数个糖果  问得到最多糖果的人是谁 约瑟夫环问题  n比较大 直接模拟会超时   通过线段树可以让每次出队在O(logN)时间内完成  类似上一道插队的题  线段树维护对应区间还有多少个人没出队  那么当我们知道出队的人...
分类:其他好文   时间:2015-07-13 22:34:13    阅读次数:237
poj2886--Who Gets the Most Candies?(线段树+反素数)
题目链接点击打开链接 题目大意:给出n个人的姓名和手里的一个号码,n个人排成一圈,号码有正有负,代表着正向还是反向移动k个位置,比赛从第k个人开始,把被选到的人踢出,问按踢出的顺序中因子数最多的是谁? 建立线段树,把n个人被踢的顺序找到,然后求出n个人中因子数最多的(最小的数)是谁,这里要用到反素数,详看链接点击打开链接 #include #include #include using...
分类:其他好文   时间:2015-07-11 12:15:23    阅读次数:105
leetcode_135_Candy
Candy   欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢 There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following...
分类:其他好文   时间:2015-06-23 15:34:56    阅读次数:99
[LeetCode] Candy 分糖果问题
There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following requi...
分类:其他好文   时间:2015-06-14 15:04:07    阅读次数:211
Java for LeetCode 135 Candy
There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following req...
分类:编程语言   时间:2015-06-03 13:35:47    阅读次数:176
Candy -- leetcode
There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child must have at least on...
分类:其他好文   时间:2015-05-29 18:18:54    阅读次数:115
LeetCode: Candy
Title:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following...
分类:其他好文   时间:2015-05-22 15:02:41    阅读次数:107
Codeforces 526C - Om Nom and Candies(贪心,暴力)
题意:你最多可以吃C千克的糖,   有两种糖,每种糖有两个参数,一个为重 w  ,一个为欢乐度 h , 如何选择才能拥有最高的欢乐度,  两种糖数量不限。 题解:看了半天题解才理解如何做, 分为两种枚举政策涵盖了所有情况, 时间复杂度为sqrt(c),神奇的暴力 1。如果两种糖中重量最大的超过sqrt(c),  那么该糖最多也只能选择不超过sqrt(c)个,   直接枚举该糖个数,记录最大欢...
分类:其他好文   时间:2015-05-21 10:55:18    阅读次数:195
LeetCode:Candy
题目描述: There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the following requirements: Each child must have ...
分类:其他好文   时间:2015-05-19 16:37:14    阅读次数:190
Candy
Candy问题:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the followi...
分类:其他好文   时间:2015-05-19 00:36:46    阅读次数:126
410条   上一页 1 ... 28 29 30 31 32 ... 41 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!