Solve the puzzle, Save the world! Problem Description In the popular TV series Heroes, there is a tagline "Save the cheerleader, Save the world!". Here Heroes continues, "Solve the puzzle, Save the world!".Finally, alien invaders visit…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=4497 解题思路:将满足条件的一组x,z,y都除以G,得到x‘,y',z',满足条件gcd(x',y',x') = 1,同时lcm(x',y',x') = G/L. 特判,当G%L != 0 时,无解. 然后素数分解G/L,假设G/L = p1^t1 * p2^t2 *````* pn^tn. 满足上面条件的x,y,z一定为这样的形式. x' = p1^i1 * p2^i2 *```* pn^in.…
J - 数论,质因数分解 Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Description Tomorrow is contest day, Are you all ready? We have been training for 45 days, and all guys must be tired.But , you are so lucky compa…
洛谷 1865 数论 线性素数筛法 最基本的线性素数筛法,当做复习欧拉筛法了,没有尝试过使用更暴力的筛法... WA了一次,手抖没打\n 传送门 (https://www.luogu.org/problem/show?pid=1865) #include <cstdio> #include <cstring> #include <algorithm> const int maxn = 1000000 + 500; int prime[maxn]; int isp[max…
[CodeForces - 1225D]Power Products [数论] [分解质因数] 标签:题解 codeforces题解 数论 题目描述 Time limit 2000 ms Memory limit 524288 kB Source Technocup 2020 - Elimination Round 2 Tags hashing math number theory *1900 Site https://codeforces.com/problemset/problem/1225…
一.题目  Gcd & Lcm game 二.分析 非常好的一题. 首先考虑比较暴力的做法,肯定要按区间进行处理,对于$lcm$和$gcd$可以用标准的公式进行求,但是求$lcm$的时候是肯定会爆$long long$的. 考虑用素数分解,将所有的数分解后,发现素因子的个数有限,且每个因子的幂也有限,最多的也就是$2^_6$,然后可以考虑将素因子用二进制的每一位进行表示.对于$2,3,5,7$可能会要的多点,所以多给给几位就可以了,最后发现,刚好可以$32$位以内. 这里就需要写两个转换函数,然…
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1836    Accepted Submission(s): 580 Problem Description Alice was felling into a cave. She found a strange door with a numbe…
Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 290    Accepted Submission(s): 60 Problem Description Alice was felling into a cave. She found a strange door with a number s…
Prime Test Time Limit: 6000MS   Memory Limit: 65536K Total Submissions: 29046   Accepted: 7342 Case Time Limit: 4000MS Description Given a big integer number, you are required to find out whether it's a prime number. Input The first line contains the…
题意:求n是否只有4个因子,如果是就输出除1外的所有因子. 模板题,就不排版了 #include<cstdio> #include<iostream> #include<algorithm> #include<cstring> #include<cmath> #include<queue> #include<map> #include<ctime> using namespace std; #define MO…