E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Candies
POJ 3159
Candies
Candies
Time Limit: 1500MS Memory Limit: 131072K Total Submissions: 19891
·
2015-10-23 08:26
poj
poj 3159
Candies
dijkstra + queue
题目链接: http://poj.org/searchproblem 题目大意: 飞天鼠是班长,一天班主任买了一大包糖果,要飞天鼠分发给大家,班里面有n个人,但是学生A认为学生B比自己多的糖果数目不应该大于c,如果不满足自己的条件,学生A就会向老师告状,在这个班级里面泰迪熊的编号是1,班长的编号是n,班长想和泰迪熊的糖果相差最大,问:在满足m个学生的要求后,班长与泰迪熊的糖果相差最大
·
2015-10-23 08:39
dijkstra
[leedcode 135] Candy
You are giving
candies
to these children subjected to the following requirements: Each child must
·
2015-10-21 12:05
code
Leetcode:Candy 每个数都比相邻数大
You are giving
candies
to these children subjected to the following requirements: Each child must
·
2015-10-21 11:36
LeetCode
Candy leetcode java
You are giving
candies
to these children subjected to the following requirements: Each child must
·
2015-10-21 10:52
LeetCode
POJ 3159
Candies
POJ_3159 一开始我想多了,有段时间就在想如果图不连通该添加一些什么约束条件。但后来突然发现,如果最后N和1不连通的话,那么这个题就无解了,想到这,题目就变的简单了,因为只有一个约束条件,d[A]-d[B]>=-c,然后将d[1]看做0,以1为起点求一个到N的最短路就可以了。 此外,这个题在用SPFA的时候,如果
·
2015-10-21 10:16
poj
SPFA+Stack||Dijkstra+Heap-POJ-3159-
Candies
CandiesTimeLimit:1500MSMemoryLimit:131072KTotalSubmissions:26380Accepted:7238DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymouse’sc
Roy_Yuan
·
2015-10-16 23:00
c
dijkstra
SPFA
POJ 3159
Candies
CandiesTimeLimit: 1500MS MemoryLimit: 131072KTotalSubmissions: 26302 Accepted: 7209DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymo
wust_ZJX
·
2015-10-06 11:00
差分约束POJ3159
Candies
(spfa+stack)解题报告
CandiesTimeLimit:1500MSMemoryLimit:131072KTotalSubmissions:26267Accepted:7197DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymouse’sc
Dafang_Xu
·
2015-09-28 16:03
图论-差分约束
差分约束POJ3159
Candies
(spfa+stack)解题报告
CandiesTimeLimit:1500MSMemoryLimit:131072KTotalSubmissions:26267Accepted:7197DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymouse’sc
Dafang_Xu
·
2015-09-28 16:03
图论-差分约束
poj 2886 Who Gets the Most
Candies
? 【线段树单点更新 + 反素数】
WhoGetstheMostCandies?TimeLimit: 5000MS MemoryLimit: 131072KTotalSubmissions: 12070 Accepted: 3771CaseTimeLimit: 2000MSDescriptionN childrenaresittinginacircletoplayagame.Thechildrenarenumberedfrom1to
chenzhenyu123456
·
2015-09-15 22:00
poj 3159
Candies
(优先队列 dijkstra+堆)
题目链接http://poj.org/problem?id=3159CandiesTimeLimit: 1500MS MemoryLimit: 131072KTotalSubmissions: 26118 Accepted: 7147DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallyth
sinat_30126425
·
2015-09-14 18:00
poj
2015多校联合第十场hdu5407CRB and
Candies
数论 唯一分解定理
ProblemDescriptionCRBhas N differentcandies.Heisgoingtoeat K
candies
.Hewondershowmanycombinationshecanselect.Canyouanswerhisquestionforall
zhou_yujia
·
2015-09-10 07:00
算法
数论
HDU
多校
HDU 5407(CRB and
Candies
-OEIS)
CRBandCandiesTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):646 AcceptedSubmission(s):321ProblemDescriptionCRBhasNdifferentcandies.HeisgoingtoeatKcand
nike0good
·
2015-08-30 19:00
hdu5407CRB and
Candies
求逆元
//求LCM(C(n,0),C(n,1),C(n,2),...,C(n,n)) //令an=LCM(C(n,0),C(n,1),C(n,2),...,C(n,n)) //b[n]=LCM(1,2,3,...,n) //a[n]=(b[n]+1)/n+1 //if(n=p^k)bn=p*(b[n−1])elseb[n]=b[n−1] #include #include #include usingn
cq_pf
·
2015-08-30 19:00
POJ 2886 Who Gets the Most
Candies
?(线段树)
Descriptionn个熊孩子按顺时针排列,每个人手上都有一张牌,牌上有一个数字,从第k个孩子开始出队,出队的熊孩子卡上数字是K,则顺时针第k人是下一个出队的,负数则逆时针,第P个出队的会得到的糖果数是P的因子个数,输出得到最多糖果的人和他的糖果数,如果有多个,则输出最先出队的Input第一行为两个整数n和k表示熊孩子个数和第一次第k个熊孩子开始出队,之后n行每行为一个字符串和一个整数表示某熊孩
V5ZSQ
·
2015-08-29 08:00
HDU 5127 Dogs'
Candies
【CDQ分治+动态凸包】
HDU5127Dogs’
Candies
【CDQ分治+动态凸包】题意:一个狗国家的狗国王有一个装糖的盒子,每颗糖有两个属性p,q,分别代表甜度和咸度,每只狗对于甜度和咸度的偏爱度不一样,所以每条狗有两个参数
u013912596
·
2015-08-25 16:00
C++
凸包
cdq分治
POJ2886 Who Gets the Most
Candies
? 线段树单点更新+反素数
题目链接:http://poj.org/problem?id=2886题目大意:n个小朋友站成一个圈做游戏,每个小朋友手中有一个非零数字num(整数代表从这点起顺时针数num个人,负数代表逆时针数num个人),游戏开始时第k个人出列,然后下一个出列的人为上一个出列人手中数字所指的人,以此类推,直到所有人都出列为止。F(p)为第p个出列的人得到的糖果数量,定义F(p)为p的约数的个数,找出得到糖果数
AC_Gibson
·
2015-08-25 10:00
HDU5407 CRB and
Candies
数论
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5407题目大意:给出一个整数n,我们想知道LCM[C(n,0),C(n,1),...,C(n,n)]%mod的值。分析:对于函数a(n)=LCM[C(n,0),C(n,1),...,C(n,n)]和函数b(n)=LCM[1,2,3,...,n],我们有a(n)=b(n)/(n+1)其中,对于b(n),我
AC_Gibson
·
2015-08-23 12:00
hdu 5407 CRB and
Candies
(数论)
题目链接:hdu5407CRBandCandiesans=LCM(1~N+1)/(N+1)%mod#include #include #include usingnamespacestd; typedeflonglongll; constintmaxn=1e6+5; constintmod=1000000007; intnc,vis[maxn],fac[maxn],F[maxn]; void
u011328934
·
2015-08-21 22:00
hdu 5407 CRB and
Candies
(乘法逆元+快速幂)
题意:求lcm(C0n,C1n,...,Cnn)=?解析:打表了发现规律是lcm(1,2,3,……n,n+1)/(n+1)然而lcm怎么求呢?可以发现随着n的增长好多最小公倍数都是不变的,增长的位置都发生在有新的质因子产生或者原本质因子的次数增大的地方。所以首先找出1~100000的所有质数,ans=∑⌊login⌋,其中0#include#include#includeusingnamespac
HelloWorld10086
·
2015-08-21 19:03
数论
hdu 5407 CRB and
Candies
(乘法逆元+快速幂)
题意:求lcm(C0n,C1n,...,Cnn)=?解析:打表了发现规律是lcm(1,2,3,……n,n+1)/(n+1)然而lcm怎么求呢?可以发现随着n的增长好多最小公倍数都是不变的,增长的位置都发生在有新的质因子产生或者原本质因子的次数增大的地方。所以首先找出1~100000的所有质数,ans=∑⌊login⌋,其中0 #include #include #include usingname
HelloWorld10086
·
2015-08-21 19:00
HDU
5407
POJ 3159
Candies
差分约束系统 spfa 附:各种最短路比较
DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymouse’sclassalargebagofcandiesandhadflymousedistributethem.Allthekidslovedcandiesvery
zhou_yujia
·
2015-08-21 18:00
算法
poj
最短路
SPFA
差分约束系统
LCM性质 + 组合数 - HDU 5407 CRB and
Candies
CRBandCandiesProblem'sLink: http://acm.hdu.edu.cn/showproblem.php?pid=5407 Mean: 给定一个数n,求LCM(C(n,0),C(n,1),C(n,2)...C(n,n))的值.(其中n#include#include#include#include#include#include#include#include#incl
crazyacking
·
2015-08-21 16:00
hdu 5407 CRB and
Candies
2015多校联合训练赛#10 找规律 素数筛法
CRBandCandiesTimeLimit:2000/1000MS(Java/Others)MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):402AcceptedSubmission(s):185ProblemDescriptionCRBhasNdifferentcandies.HeisgoingtoeatKcandies.Hewo
GDRetop
·
2015-08-21 16:03
##ACM-ICPC编程题
##数学
hdu 5407 CRB and
Candies
2015多校联合训练赛#10 找规律 素数筛法
CRBandCandiesTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):402 AcceptedSubmission(s):185ProblemDescriptionCRBhas N differentcandies.Heisgoingtoeat K
firenet1
·
2015-08-21 16:00
HDU
and
Candies
找规律
CRB
素数筛法
2015多校联合训练赛#10
5407
【HDOJ 5407】 CRB and
Candies
(大犇推导
【HDOJ5407】CRBandCandies赛后看这题题解只有满眼的迷茫………………g(N) = LCM(C(N,0),C(N,1),...,C(N,N)) f(n)\=\LCM(1,2,...,n)f(n) = LCM(1,2,...,n),thefact g(n)\=\f(n+1)/(n+1)g(n) = f(n+1)/(n+1)f(n)\=\LCM(1,2,...,n)f(1)=1If n
ChallengerRumble
·
2015-08-21 16:00
HDU 5407 CRB and
Candies
(2015年多校比赛第10场)
1.题目描述:点击打开链接2.解题思路:本题要求LCM(C(n,0),C(n,1),...,C(n,n)),官方题解是转化为求解LCM(1,2,3,...n+1)/(n+1),然而这种做法还是觉得太陌生,不妨试着用学过的唯一分解定理去做。首先,求这n+1个数的LCM,实际上就是求所有小于n的素数中,对于每一个素数Pi,哪一项的指数最大,然后把他们连乘起来即可得到LCM值。因此,问题转化为确定每一个
u014800748
·
2015-08-21 15:00
数论
LCM
组合数去摸
HDU 5407 CRB and
Candies
(数学 素数表+预处理+快速幂+乘法逆元)——多校练习10
MemoryLimit:65536/65536K(Java/Others)ProblemDescriptionCRBhas N differentcandies.Heisgoingtoeat K
candies
.Hewondershowmanycombinationshecanselect.Can
queuelovestack
·
2015-08-21 15:00
数学
ACM
预处理
快速幂
乘法逆元
CRB and
Candies
(lcm(C(n,0)..C(n,n)=lcm(1,2,,,n+1)/(n+1)))hdu5407
CRBandCandiesTimeLimit:2000/1000MS(Java/Others) MemoryLimit:65536/65536K(Java/Others)TotalSubmission(s):358 AcceptedSubmission(s):160ProblemDescription CRBhas N differentcandies.Heisgoingtoeat K
u010579068
·
2015-08-21 14:00
gcd
2015
LCM
and
Candies
CRB
hdu5407
Multi-Universit
【数论】 HDOJ 5407 CRB and
Candies
数论结论题。。。就是1-n+1的lcm除以n+1。。。。不知道结论怎么做?----没法做。。。#include usingnamespacestd; typedeflonglongLL; constintmaxn=1000005; constintN=1000000; constintmod=1e9+7; intval[maxn]; LLf[maxn]; LLg[maxn]; intp[max
blankcqk
·
2015-08-21 10:00
数论
poj-3159
Candies
(差分约束问题)
CandiesTimeLimit:1500MSMemoryLimit:131072KTotalSubmissions:25821Accepted:7050DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymouse’sc
B_mess
·
2015-08-21 09:26
Spfa
HDU 5407 CRB and
Candies
(Kummer定理)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5407题意:给定n,求C(n,0),C(n,1),...,C(n,n)的lcm(最小公倍数)对1e9+7取模的值。分析:C(n,k)中只包含不大于n的素因子,对每个素因子p,需要找出这n个组合数中p的幂最大的,由Kummer定理,这相当于找一个k,使得在p进制下n-k发生借位的次数最多,容易知道,在p进
quailty
·
2015-08-20 21:00
POJ 3159
Candies
(差分约束基础题,栈式SPFA)
CandiesTimeLimit:1500MSMemoryLimit:131072KTotalSubmissions:25818Accepted:7049DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymouse’sc
zwj1452267376
·
2015-08-20 20:00
HDU 5407 CRB and
Candies
传送门http://oeis.org/A002944http://oeis.org/A003418令an=LCM(C(n,0),C(n,1),C(n,2),...,C(n,n))bn=LCM(1,2,3,...,n)an=bn+1n+1if (n=pk)bn=p∗bn−1elsebn=bn−1结论的证明:http://arxiv.org/pdf/0906.2295v2.pdf#include us
u011788531
·
2015-08-20 17:00
公式
数学
C语言
POJ 2886 Who Gets the Most
Candies
? (线段树 约瑟夫环问题变种)
题目大意:就是现在有一些孩子坐成一圈,每个人手里有一个数字(正数或者负数),孩子们编号1~n,n #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #includ
u013738743
·
2015-08-16 01:00
线段树
poj
2886
uva 10118 记忆化搜索
LittleBobisplayingagame.Hewantstowinsomecandiesinit-asmanyaspossible.Thereare4piles,eachpilecontainsNcandies.Bobisgivenabasketwhichcanholdatmost5
candies
.Eachtime
DoJintian
·
2015-08-10 19:00
ACM
uva
Candies
( POJ 3159)
DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymouse’sclassalargebagofcandiesandhadflymousedistributethem.Allthekidslovedcandiesvery
u010524510
·
2015-07-28 11:00
最短路径
dijkstra
poj 3159
Candies
【简单差分约束】 【SPFA + 数组模拟栈】
CandiesTimeLimit:1500MSMemoryLimit:131072KTotalSubmissions:25010Accepted:6783DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymouse’sc
笑着走完自己的路
·
2015-07-25 22:35
差分约束
POJ 3159--
Candies
【基础差分规划】
CandiesTimeLimit: 1500MS MemoryLimit: 131072KTotalSubmissions: 25002 Accepted: 6782DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythehead-teacherbroughtthekidsofflymo
hpuhjh
·
2015-07-25 21:00
POJ 3159
Candies
差分约束
链接:http://poj.org/problem?id=3159CandiesTimeLimit: 1500MS MemoryLimit: 131072KTotalSubmissions: 24852 Accepted: 6737DescriptionDuringthekindergartendays,flymousewasthemonitorofhisclass.Occasionallythe
u013532224
·
2015-07-15 20:00
差分约束
poj2886--Who Gets the Most
Candies
?(线段树+反素数)
题目链接点击打开链接题目大意:给出n个人的姓名和手里的一个号码,n个人排成一圈,号码有正有负,代表着正向还是反向移动k个位置,比赛从第k个人开始,把被选到的人踢出,问按踢出的顺序中因子数最多的是谁?建立线段树,把n个人被踢的顺序找到,然后求出n个人中因子数最多的(最小的数)是谁,这里要用到反素数,详看链接点击打开链接#include #include #include usingnamespace
u013015642
·
2015-07-11 10:00
Candy
You are giving
candies
to these children subjected to the following requirements: Each child must
likesky3
·
2015-07-05 21:00
ca
POJ 2886 Who Gets the Most
Candies
? (三种姿势点草动态求第k大)
WhoGetstheMostCandies?题意: N个孩子顺时针坐成一个圆圈且从1到N编号,每个孩子手中有一张标有非零整数的卡片。第K个孩子先出圈,如果他手中卡片上的数字A大于零,下一个出圈的是他左手边第A个孩子。否则,下一个出圈的是他右手边第(-A)个孩子。第p个出圈的孩子会得到F(p)个糖果,F(p)为p的因子数。求得到糖果数最多的是哪个孩子及得到多少糖果。思路:模拟约瑟夫环的感觉注意处理取
lwt36
·
2015-06-17 02:00
动态求第k大
[LeetCode] Candy 分糖果问题
You are giving
candies
to these children subjected to the following requirements: Each child must
·
2015-06-14 14:00
LeetCode
CF Om Nom and
Candies
分析:输入总重量c,红糖幸福值hr,蓝糖幸福值hb,红糖重wr,蓝糖重wb.输出最大的幸福值。直接暴力就可以了。为了防止时间超限,限制它的循环次数。#include intmain() { __int64c,hr,hb,wr,wb,r,b,i,j,max=0,time=10000000; scanf("%I64d%I64d%I64d%I64d%I64d",&c,&hr,&hb,&wr,&wb);
ZengAMing
·
2015-05-17 21:00
ACM
CF
Candy
You are giving
candies
to these children subjected to the following requirements: Each child must
·
2015-05-16 19:00
ca
(LeetCode 135) Candy
You are giving
candies
to these children subjected to the following requirements: Each child must
·
2015-05-06 20:00
LeetCode
Who Gets the Most
Candies
?
TimeLimit: 5000MS MemoryLimit: 131072KTotalSubmissions: 11303 Accepted: 3520CaseTimeLimit: 2000MSDescriptionN childrenaresittinginacircletoplayagame.Thechildrenarenumberedfrom1to N inclockwiseorder.Ea
Kirito_Acmer
·
2015-04-27 13:00
线段树
Om Nom and
Candies
(ZeptoLab Code Rush 2015)
C.OmNomandCandiestimelimitpertest1secondmemorylimitpertest256megabytesinputstandardinputoutputstandardoutputAsweetlittlemonsterOmNomlovescandiesverymuch.Onedayhefoundhimselfinarathertrickysituationtha
AC_way
·
2015-04-14 13:42
Codeforces
上一页
4
5
6
7
8
9
10
11
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他