这题就是 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…
题意: 就是求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位方案…
Problem F LCM Cardinality Input: Standard Input Output: Standard Output Time Limit: 2 Seconds A pair of numbers has a unique LCM but a single number can be the LCM of more than one possible pairs. For example 12 is the LCM of (1, 12), (2, 12), (3,4)…
A pair of numbers has a unique LCM but a single number can be the LCM of more than one possiblepairs. For example 12 is the LCM of (1, 12), (2, 12), (3,4) etc. For a given positive integer N, thenumber of different integer pairs with LCM is equal to N…
LCM Cardinality Input: Standard Input Output: Standard Output Time Limit: 2 Seconds A pair of numbers has a unique LCM but a single number can be the LCM of more than one possible pairs. For example 12 is the LCM of (1, 12), (2, 12), (3,4) etc. For a…
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) ==…
题目大意 给定一个三元组\((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…
LCM Cardinality Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit Status Description   Problem FLCM CardinalityInput: Standard Input Output: Standard Output Time Limit: 2 Seconds A pair of numbers has a unique LCM but a si…
题意: 就是求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…