一、题目 POJ2886 二、分析 这个题目吧,开始没读懂,做的时候也没懂,WA的时候懂了。假设是第p个出圈的人有一个对应的因子个数$F(p)$,那么,题目求的就是这个$F(p)$最大的对应的人。 1.首先要对所有$F(p)$值进行预处理打表。因为多次询问。 2.每次都会有一个人出圈,那么为了能够每 ...
分类:
编程语言 时间:
2019-03-15 14:40:18
阅读次数:
169
题目:Who Gets the Most Candies? 链接:http://poj.org/problem?id=2886 分析: 1)这是一个约瑟夫环,关键在于如何定位下一个位置。如同楼层没有0层一样,针对card需要分正负讨论,计算出在新环中下一个离开的位置k。 2)求出k在原环中的位置。采 ...
分类:
其他好文 时间:
2019-02-02 10:22:07
阅读次数:
197
思路: 先打反素数表,即可确定因子最多的那个数。然后模拟踢人的过程确定对应的人名。模拟的过程使用线段树优化加速。 实现: ...
分类:
其他好文 时间:
2018-02-22 23:08:23
阅读次数:
251
Description N children are sitting in a circle to play a game. The children are numbered from 1 to N in clockwise order. Each of them has a card with ...
分类:
其他好文 时间:
2017-09-03 23:36:53
阅读次数:
172
N children are sitting in a circle to play a game. The children are numbered from 1 to N in clockwise order. Each of them has a card with a non-zero i ...
分类:
其他好文 时间:
2017-02-17 17:01:46
阅读次数:
297
题目链接点击打开链接
题目大意:给出n个人的姓名和手里的一个号码,n个人排成一圈,号码有正有负,代表着正向还是反向移动k个位置,比赛从第k个人开始,把被选到的人踢出,问按踢出的顺序中因子数最多的是谁?
建立线段树,把n个人被踢的顺序找到,然后求出n个人中因子数最多的(最小的数)是谁,这里要用到反素数,详看链接点击打开链接
#include
#include
#include
using...
分类:
其他好文 时间:
2015-07-11 12:15:23
阅读次数:
105
DescriptionN children are sitting in a circle to play a game.The children are numbered from 1 to N in clockwise order. Each of them has a card with a ...
分类:
其他好文 时间:
2015-03-14 10:59:21
阅读次数:
169
Who Gets the Most Candies?
Time Limit: 5000MS
Memory Limit: 131072K
Total Submissions: 9416
Accepted: 2868
Case Time Limit: 2000MS
Description
N children are s...
分类:
其他好文 时间:
2014-07-09 12:46:35
阅读次数:
234