A. Relic Discovery B. Pocket Cube C. Pocky D. Lucky Coins E. Fibonacci F. Lambda Calculus G. Coding Contest H. Pattern I. Travel Brochure J. Cliques K Read More
Supreme Number 1000ms 131072K A prime number (or a prime) is a natural number greater than 111 that cannot be formed by multiplying two smaller natura Read More
求出树上最远的两个点的距离 原题链接:http://lx.lanqiao.cn/problem.page?gpid=T32 参考博客:https://blog.csdn.net/buctyyzyn/article/details/44886697 Read More
DFS适合此类题目:给定初始状态跟目标状态,要求判断从初始状态到目标状态是否有解。 广搜的模板: Void bfs() { 赋初值head,tail,duilie[1]; While(队列不为空){ Head++; For(将状态遍历一遍){ If(满足情况){ Tail++; 入队; 记录已入过队 Read More
Find Integer Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 6597 Accepted Submission(s): 1999Spe Read More
带分数 数字1~9分别出现且只出现一次这类题目:把9个数分成题目要求的几份即可。再通过sprintf把每个部分拼接起来,成为s字符串。最后判断字符串即可。提示:长度为9,排序后是“123456789”。如果枚举超时可以考虑再多写一个函数,舍去有0的情况、有重复数字的情况。 参考博客:https:// Read More
素数筛 + 前缀和 模板 Read More
参看原博客:https://blog.csdn.net/tianyizhicheng/article/month/2018/09 Read More
J. Sum A square-free integer is an integer which is indivisible by any square number except 111. For example, 6=2⋅36 = 2 \cdot 36=2⋅3 is square-free, Read More
积性函数、杜教筛 练习题 莫比乌斯函数之和 51Nod - 1244 莫比乌斯函数,由德国数学家和天文学家莫比乌斯提出。梅滕斯(Mertens)首先使用μ(n)(miu(n))作为莫比乌斯函数的记号。具体定义如下: 如果一个数包含平方因子,那么miu(n) = 0。例如:miu(4), miu(12 Read More