uva10892
来源:互联网 发布:汉译英最好的软件 编辑:程序博客网 时间:2024/05/19 03:25
求翻译。我翻译出来还是只懂个大概。。求解答这题!
Consider two numbers a and b, whose prime factorizations are and, respectively. Then their LCM is This is the insight that lets us solve the problem.
So factorize N: . Now say that we have a and b such that LCM(a,b) = N. Then for each i, at least one ofai and bi is equal to ni. This would suggest that there are 2ni + 1 possibilities for each prime factor, and that if we multiply them all together, we're done. Unfortunately, we run into the issue of overcounting. Thus we need to modify this approach somewhat. We will solve this problem incrementally and recursively.
For a given N, call the smallest prime factor p1, and say that n1 is the largest power ofp1 that divides N. Break the problem into two cases. In case one, we seta1 < b1 =n1. This gives us n1 possibilities for the first number, and for the rest, we can simply take the product of(2ni + 1) fori > 1. (Verify that this does not count any pairs more than once.) In the other case, we havea1 = b1 =n1. In this case, we just need to solve the same problem, but for. (Similarly, verify that these two cases together do not miss any pairs.) The base case of our recursion is when N = 1, in which case we just return 1.
- uva10892
- uva10892
- uva10892
- UVa10892
- Uva10892 LCM Cardinality
- LCM的个数 UVa10892
- UVA10892 LCM Cardinality(gcd)
- UVA10892 最小公倍数素因子分解
- UVA10892 - LCM Cardinality(分解质因子)
- uva10892——LCM Cardinality(最小公倍数质因子分解)
- 设计模式赖以实现的基础:抽象
- 随手摘抄
- 一月六号总结
- ThinkPHP 中M方法和D方法的具体区别
- .NET 4.0里异常处理的新机制
- uva10892
- 不含中间变量的两数交换逻辑
- 小心37%法则
- 洗牌算法
- 基数排序之LSD篇 (知识点小结)
- 考研小结
- ssh
- PIL 图片比较
- ssh安全远程登录的身份认证原理