#1013

1013 Battle Over Cities (25 分)

Itisvitallyimportanttohaveallthecitiesconnectedbyhighwaysinawar.Ifacityisoccupiedbytheenemy,allthehighwaysfrom/towardthatcityareclosed.Wemustknowimmediatelyifwe...
代码星球 ·2020-08-09

pat 1013 Battle Over Cities(25 分) (并查集)

1013 BattleOverCities(25 分)Itisvitallyimportanttohaveallthecitiesconnectedbyhighwaysinawar.Ifacityisoccupiedbytheenemy,allthehighwaysfrom/towardthatci...
代码星球 ·2020-06-08

HDU 1013 Digital Roots【字符串,水】

TimeLimit:2000/1000MS(Java/Others)    MemoryLimit:65536/32768K(Java/Others)TotalSubmission(s):79339    AcceptedSubmissio...

B1013(通过)

这种方法是采用B1017的那个求素数的算法,并且送一个比较大的数值当作上线(20000),也可以进一步压缩,但是这个数已经够用了,就没有再试了。python方便是方便,但是真的慢defisPrime(n,result):flag=[1]*(n+2)p=2while(p<=n):result.append(p)fo...
代码星球 ·2020-04-09

B1013

python语言运行这道题有一个点运行超时,需要对求素数的算法进一步的优化defisPrime(n):ifn<=1:returnFalsei=2whilei*i<=n:ifn%i==0:returnFalsei+=1returnTrueif__name__=="__main__":str=input().s...
代码星球 ·2020-04-09

1013. Battle Over Cities (25)

Itisvitallyimportanttohaveallthecitiesconnectedbyhighwaysinawar.Ifacityisoccupiedbytheenemy,allthehighwaysfrom/towardthatcityareclosed.Wemustknowimmediatelyifwe...
代码星球 ·2020-04-08

1013. 数素数 (20)

令Pi表示第i个素数。现任给两个正整数M<=N<=104,请输出PM到PN的所有素数。输入格式:输入在一行中给出M和N,其间以空格分隔。输出格式:输出从PM到PN的所有素数,每10个数字占1行,其间以空格分隔,但行末不得有多余空格。输入样例:527输出样例:1113171923293137414347535...
代码星球 ·2020-04-08
首页上一页12下一页尾页