摘要: 简单了解了一下数论,有些东西没弄懂,就纪录一下数论的简单知识,以备不时之需 1 素数筛法 (1)埃式筛法 最简单思路:所有可能的因数全部试一遍。(特判1和2不是素数) (2)欧拉筛法(线性筛法) 本代码保证每个合数只会被它的最小质因数筛去,因此每个数只会被标记一次,所以时间复杂度是O(n) (3)区 阅读全文
posted @ 2019-06-09 13:47 陈墨cacm 阅读(593) 评论(0) 推荐(0) 编辑
摘要: Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only i 阅读全文
posted @ 2019-06-04 15:28 陈墨cacm 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Tomorrow Peter has a Biology exam. He does not like this subject much, but ddays ago he learnt that he would have to take this exam. Peter's strict pa 阅读全文
posted @ 2019-05-30 19:50 陈墨cacm 阅读(208) 评论(0) 推荐(0) 编辑
摘要: 浙大出题 zoj链接 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=4115 签到题,太菜了,最后没签出来 思路:先遍历一次找出ans最大值,然后平移乘以k-1次,再遍历一次比较最大值 阅读全文
posted @ 2019-05-13 20:40 陈墨cacm 阅读(230) 评论(0) 推荐(0) 编辑
摘要: Let's denote a function f(x)f(x) in such a way: we add 11 to xx , then, while there is at least one trailing zero in the resulting number, we remove t 阅读全文
posted @ 2019-05-09 20:57 陈墨cacm 阅读(181) 评论(0) 推荐(0) 编辑
摘要: Polycarpus just has been out of luck lately! As soon as he found a job in the "Binary Cat" cafe, the club got burgled. All ice-cream was stolen. On th 阅读全文
posted @ 2019-05-04 10:02 陈墨cacm 阅读(260) 评论(0) 推荐(0) 编辑
摘要: Problem Statement There is an empty array. The following N operations will be performed to insert integers into the array. In the i-th operation (1≤i≤ 阅读全文
posted @ 2019-04-29 21:07 陈墨cacm 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Year 2118. Androids are in mass production for decades now, and they do all the work for humans. But androids have to go to school to be able to solve 阅读全文
posted @ 2019-04-27 20:41 陈墨cacm 阅读(153) 评论(0) 推荐(0) 编辑
摘要: There is an array with n elements a1, a2, ..., an and the number x. In one operation you can select some i (1 ≤ i ≤ n) and replace element ai with ai  阅读全文
posted @ 2019-04-23 15:35 陈墨cacm 阅读(258) 评论(0) 推荐(0) 编辑
摘要: The i’th Fibonacci number f(i) is recursively defined in the following way: • f(0) = 0 and f(1) = 1 • f(i + 2) = f(i + 1) + f(i) for every i ≥ 0 Your 阅读全文
posted @ 2019-04-19 12:55 陈墨cacm 阅读(108) 评论(0) 推荐(0) 编辑