题目大意 给定一个三元组\((x,y,z)\)的\(gcd\)和\(lcm\),求可能的三元组的数量是多少,其中三元组是的具有顺序的 其中\(gcd\)和\(lcm\)都是32位整数范围之内 由算术基本定理可以得知: 如果$k=gcd(m,n) \(则\) k_p=min(m_p,n_p)$ 如果\(k=lcm(m,n)\)则\(k_p=max(m_p,n_p)\) 那么我们可以把每个质因数分开讨论,因为三元组是有序的,所以我们考虑每两个数成为gcd和lcm的,另一个数在\((p_gcd,p_l…
题意: 就是求a的因数中大于b的有几对 解析: 先把素数打表 运用算术基本定理 求出a的所有因数的个数 然后减去小于b的因数的个数 代码如下: #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #include <stac…
题意: 就是....求a的所有大于b的因子有多少对 算术基本定理求 所有因子 阿欧...偷张图. 注意范围 就好  ..... 解析: 在1 -1012的范围内求大于b的所有a的因子的对数(有几对) 就等于 在1 -1012的范围内求出a的所有因子 除二  减去  在1 - (b-1)的范围内a的所有因子 #include<iostream> #include<algorithm> #include<cstring> #include<cstdio> #in…
www.51nod.com/onlineJudge/questionCode.html#!problemId=1189 1189 阶乘分数 题目来源: Spoj 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 1/N! = 1/X + 1/Y(0<x<=y),给出N,求满足条件的整数解的数量.例如:N = 2,1/2 = 1/3 + 1/6,1/2 = 1/4 + 1/4.由于数量可能很大,输出Mod 10^9 + 7.   Input 输入一个…
Pairs Forming LCM (LightOJ - 1236)[简单数论][质因数分解][算术基本定理](未完成) 标签: 入门讲座题解 数论 题目描述 Find the result of the following code: long long pairsFormLCM( int n ) { long long res = 0; for( int i = 1; i <= n; i++ ) for( int j = i; j <= n; j++ ) if( lcm(i, j) ==…
Aladdin and the Flying Carpet (LightOJ - 1341)[简单数论][算术基本定理][分解质因数](未完成) 标签:入门讲座题解 数论 题目描述 It's said that Aladdin had to solve seven mysteries before getting the Magical Lamp which summons a powerful Genie. Here we are concerned about the first myste…
Sigma Function (LightOJ - 1336)[简单数论][算术基本定理][思维] 标签: 入门讲座题解 数论 题目描述 Sigma function is an interesting function in Number Theory. It is denoted by the Greek letter Sigma (σ). This function actually denotes the sum of all divisors of a number. For exam…
题意: 就是求1-n中有多少对i 和 j 的最小公倍数为n  (i <= j) 解析: 而这题,我们假设( a , b ) = n ,那么: n=pk11pk22⋯pkss, a=pd11pd22⋯pdss, b=pe11pe22⋯pess, 可以确定max(ei,di)=ki,      关于这点 可以自己反证一下 那么ki的组成就是ei与di中一个等于ki, 另一个任取[0,ki-1]中的一个数, 那么就有 2ki 种方案, 由于 ei=di=ki 只有一种,(两种都为ki) 所以第i位方案…
这题就是 LightOJ - 1236 解析去看这个把https://www.cnblogs.com/WTSRUVF/p/9185140.html 贴代码了: #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <vector> #include…
题意:给一个矩形(非正方形)面积a和最小边长b,要求边长均大于b,求这样的矩形有几个 思路:先用到了之前学的质因数分解,还有一个新的公式: 然后我们可以先算出a的所有约数,因为只算约数个数面积重复,所以要/2:然后暴力出<b的所有约数减去. 技巧:1.用save[i]*save[i]<=temp剪枝 2.要注意判断出循环的ans是否大于1,如果大于1则表示还有一个素数没除尽,*2 代码: #include<cstdio> #include<cstring> #inclu…