![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
素筛
文章平均质量分 88
无
旺 崽
这个作者很懒,什么都没留下…
展开
-
2021牛客寒假算法基础集训营2 I.牛牛的“质因数”
2021牛客寒假算法基础集训营2 I.牛牛的“质因数”题目链接题目描述算数基本定理,又称唯一分解定理,算术基本定理可表述为:任何一个大于1的自然数 N,如果N不为质数,那么N可以唯一分解成有限个质数的乘积。即 N=p1e1⋅p2e2...pmem(p1<p2<...pm)N=p_1^{e_1}\cdot p_2^{e_2}...p_m^{e_m}(p_1 < p_2< ... p_m)N=p1e1⋅p2e2...pmem(p1<p2<...pm)原创 2021-02-04 14:45:25 · 1845 阅读 · 0 评论 -
牛客练习赛70 C.Mu函数
牛客练习赛70 C.Mu函数题目链接题目描述输入描述:第一行一个正整数T表示数据组数接下来T行每行两个数n,k输出描述:共T行每行一个答案示例1输入21 13 2输出21打表很容易发现存在循环节,而且循环节的长度非常小,所以对每组输入,找循环节即可,AC代码如下:#include <bits/stdc++.h>using namespace std;typedef long long ll;const ll N=1e6+10;ll prime[N]原创 2020-09-26 09:22:02 · 2552 阅读 · 0 评论 -
2020中国大学生程序设计竞赛(CCPC) - 网络选拔赛 1005 Lunch
HDUOJ 6892 Lunch题目链接Problem DescriptionNow it’s time for lunch. Today’s menu is chocolate!Though every baby likes chocolate, the appetites of babies are little. After lunch, there are still n pieces of chocolate remained: The length of the ith piece is原创 2020-09-21 12:44:42 · 11066 阅读 · 2 评论 -
AtCoder Beginner Contest 177 E.Coprime
AtCoder Beginner Contest 177 E.Coprime题目链接这题我直接想到了质因数分解????,先素筛出 1e61e61e6 的质因数,然后对每个数质因数分解,每个质因数都标记一下,如果没有重复,那么这一组数肯定两两互质;如果重复,求这一组数的公因数,如果是 111,输出 setwise coprimesetwise\ coprimesetwise coprime,否则输出 not coprimenot\ coprimenot copri原创 2020-08-30 09:05:35 · 2593 阅读 · 0 评论 -
HDUOJ 6623 Minimal Power of Prime
HDUOJ 6623 Minimal Power of Prime题目链接Problem DescriptionYou are given a positive integer n > 1. Consider all the different prime divisors of n. Each of them is included in the expansion n into prime factors in some degree. Required to find among the原创 2020-08-04 17:31:35 · 2326 阅读 · 0 评论 -
Codeforces Round #257 (Div. 1) C. Jzzhu and Apples
Codeforces Round #257 (Div. 1) C. Jzzhu and Apples题目链接Jzzhu has picked n apples from his big apple tree. All the apples are numbered from 1 to n. Now he wants to sell them to an apple store.Jzzhu will pack his apples into groups and then sell them. Each原创 2020-07-22 10:56:01 · 2373 阅读 · 0 评论 -
2020牛客暑期多校训练营(第四场)H.Harder Gcd Problem
2020牛客暑期多校训练营(第四场)H.Harder Gcd Problem题目链接题目描述After solving the Basic Gcd Problem, ZYB gives you a more difficult one:Given an integer {n}n, find two subset A{A}A and B{B}B of {1,2,…,n}\{1,2,\dots,n\}{1,2,…,n} such that:∣A∣=∣B∣=m{|A|=|B|=m}∣A∣=∣原创 2020-07-22 10:46:30 · 2430 阅读 · 0 评论 -
LightOJ 1220 Mysterious Bacteria
LightOJ 1220 Mysterious BacteriaDr. Mob has just discovered a Deathly Bacteria. He named it RC-01. RC-01 has a very strange reproduction system. RC-01 lives exactly x days. Now RC-01 produces exactly p new deadly Bacteria where x=bpx = b^px=bp (where b, p原创 2020-07-02 19:36:16 · 2406 阅读 · 0 评论