Who Gets the Most Candies?
Time Limit: 5000MS
Memory Limit: 131072K
Total Submissions: 10234
Accepted: 3177
Case Time Limit: 2000MS
Description
N children are si...
分类:
其他好文 时间:
2014-09-19 15:40:15
阅读次数:
189
题目链接:poj 2886 Who Gets the Most Candies?
题目大意:N个人围成一圈玩约瑟夫环游戏,不同的是,步长不固定,由前一个出局的人决定,给定K表示起始的人。第i个淘汰的人将获得g(i)个糖果,问说谁获得的糖果最多。g(x)为x的因子个数。
解题思路:起始g(x)是成阶段的,所以打表处理处g(x)递增值,对于每个N,一开始找到小于等于N的最大x,那么第x个淘...
分类:
其他好文 时间:
2014-09-18 19:02:24
阅读次数:
250
原题地址:https://oj.leetcode.com/problems/candy/题意:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to ...
分类:
编程语言 时间:
2014-09-14 11:21:16
阅读次数:
172
Candy
Total Accepted: 17540 Total
Submissions: 92484My Submissions
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these childre...
分类:
其他好文 时间:
2014-09-09 16:05:39
阅读次数:
187
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...
分类:
其他好文 时间:
2014-09-04 23:43:20
阅读次数:
184
三种解法:推荐第一种和最后一种,
方法一:遍历2次,时间复杂度:O(n),看见复杂度:o(n)
方法三:遍历一次,时间复杂度:o(n), 空间复杂大:o(1)
/* There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these c...
分类:
其他好文 时间:
2014-09-04 10:32:09
阅读次数:
200
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...
分类:
其他好文 时间:
2014-09-03 21:15:27
阅读次数:
248
这题想了好久才弄懂,首先题意是要求最先出队且获得的糖果数最多的人,所以只需要在循环中每次判断此时出队的人获得的糖果数是否比别人多
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
using...
分类:
其他好文 时间:
2014-09-03 11:16:06
阅读次数:
150
1 Candy题目:There areNchildren standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the follo...
分类:
其他好文 时间:
2014-08-28 16:08:29
阅读次数:
294
原题戳我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...
分类:
其他好文 时间:
2014-08-28 12:59:49
阅读次数:
254