算术基本定理
风之旅@
努力到一定的程度,幸运就会与你不期而遇
展开
-
POJ - 1142 A - Smith Numbers
While skimming his phone directory in 1982, Albert Wilansky, a mathematician of Lehigh University,noticed that the telephone number of his brother-in-law H. Smith had the following peculiar property:...原创 2018-09-05 15:59:15 · 130 阅读 · 0 评论 -
算术基本定理及其使用
定义:任何一个大于1的自然数N,如果N不为质数,那么N可以分解成有限个质数的乘积,并且在不计次序的情况下,这种分解方式是唯一的。例如60可以分解为: 数学公式描述 ( & is prime number and ri>=0)代码实现:map <int , int > prime_factor...原创 2018-09-08 23:05:22 · 817 阅读 · 0 评论 -
LightOJ - 1236 Pairs Forming LCM
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)...原创 2018-09-08 23:32:08 · 164 阅读 · 0 评论 -
LightOJ - 1278 Sum of Consecutive Integers
Given an integer N, you have to find the number of ways you can express N as sum of consecutive integers. You have to use at least two integers.For example, N = 15 has three solutions, (1+2+3+4+5),...原创 2018-09-09 13:46:54 · 227 阅读 · 0 评论 -
HDU - 1695 GCD (容斥原理+质因子分解)
Given 5 integers: a, b, c, d, k, you're to find x in a...b, y in c...d that GCD(x, y) = k. GCD(x, y) means the greatest common divisor of x and y. Since the number of choices may be very large, you'r...原创 2018-09-06 22:54:27 · 183 阅读 · 0 评论