lightoj 1215】的更多相关文章

这题和这题一样......只不过多了个数... Finding LCM LightOJ - 1215 https://www.cnblogs.com/WTSRUVF/p/9316412.html #include <iostream> #include <cstdio> #include <sstream> #include <cstring> #include <map> #include <set> #include <ve…
lightoj 1215 Finding LCM 链接:http://www.lightoj.com/volume_showproblem.php?problem=1215 题意:已知 a, b, l 和 lcm(a, b, c) = l ,求最小的 c 的值. 思路:先找 l 的素因子并判断此因子是否为 a, b 的素因子,如果是,则判断他们各自的欧拉值的大小.因为 c 最大可能等于 l 的值,所以刚开始先把 l 的值赋给 c . 当 l 中的某个素因子的欧拉值(lr1)大于 a,b 中相同的…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1215 题意:已知三个数a b c 的最小公倍数是 L ,现在告诉你 a b  L 求最小的 c ; 其实就是告诉你(最小公倍数LCM)LCM(x, y) = L 已知 x 和 L 求 最小的 y ; L = LCM(x, y)=x*y/gcd(x, y);如果把x,y,L写成素因子之积的方式会很容易发现 L 就是 x 和 y 中素因子指数较大的那些数之积; 例如LCM(24, y)…
Discription LCM is an abbreviation used for Least Common Multiple in Mathematics. We say LCM (a, b, c) = L if and only if L is the least integer which is divisible by a, b and c. You will be given a, b and L. You have to find c such that LCM (a, b, c…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1236 题意:给你一个数n,求有多少对(i,  j)满足 LCM(i, j) = n, (i<=j),  n <= 1e14: 之前做的那道LightOj 1215 中有说过:LCM(x, y) = ∏(所有质因子幂高的项之积); 那么本题就先把n分解质因子幂的形式,即 n = p1a1*p2a2*...*pkak;(pi为质数) 现在先不管i和j的大小,当 i 中包含因子p1a1时…
http://lightoj.com/volume_showproblem.php?problem=1422 做的第一道区间DP的题目,试水. 参考解题报告: http://www.cnblogs.com/ziyi--caolu/p/3236035.html http://blog.csdn.net/hcbbt/article/details/15478095 dp[i][j]为第i天到第j天要穿的最少衣服,考虑第i天,如果后面的[i+1, j]天的衣服不要管,那么dp[i][j] = dp[i…
题目链接:http://lightoj.com/volume_showproblem.php?problem=1298 题意:给你两个数 n, p,表示一个数是由前 k 个素数组成的,共有 n 个素数,然后求这样的所有的数的欧拉和: 例如 n = 3, p=2; 前两个素数是2,3, 然后因为n=3,所以要再选一个素数组成一个数,有两种选择2*3*2=12 和 2*3*3=18 结果就是Φ(12)+Φ(18) = 10; 我们可以用dp[i][j] 表示前 j 个素数中选择 i 个的结果,Φ[n…
http://lightoj.com/volume_showproblem.php?problem=1214 这就是一道简单的大数取余. 还想还用到了同余定理: 所谓的同余,顾名思义,就是许多的数被一个数d去除,有相同的余数.d数学上的称谓为模.如a=6,b=1,d=5,则我们说a和b是模d同余的.因为他们都有相同的余数1. //// 数学上的记法为: a≡ b(mod d) 可以看出当n<d的时候,所有的n都对d同商,比如时钟上的小时数,都小于12,所以小时数都是模12的同商. 对于同余有三种…
相关代码请戳 https://coding.net/u/tiny656/p/LightOJ/git 1006 Hex-a-bonacci. 用数组模拟记录结果,注意取模 1008 Fibsieve's Fantabulous Birthday. 找规律题,左边列是1 3平方 5平方......下边行是1 2平方 4平方......,找到当前数被包夹的位置,然后处理一下位置关系,注意奇偶. 1010 Kinghts in Chessboard. 规律题,对于m,n大于2的情况下,使用交叉放置的方法…
Aladdin and the Flying Carpet Time Limit:3000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1341 Appoint description:  System Crawler  (2016-07-08) Description It's said that Aladdin had to solve seven myst…