X-factor Chains(POJ3421 素数)】的更多相关文章

Description    给定一个正整数X, 一个长度为m的X-因子链是由m+1个整数组成的.其中    1 = X0, X1, X2, …, Xm = X 满足Xi < Xi+1 且 Xi 整除 Xi+1 .    现在要求X-因子链的最大长度和最大长度有多少条?Input    多组数据,每一组数据一个正整数X (X ≤ 220).Output    对于每组数据,输出X-因子链的最大长度和最大长度有多少条Sample Input    2    3    4    10    100S…
X-factor Chains Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 6212   Accepted: 1928 Description Given a positive integer X, an X-factor chain of length m is a sequence of integers, 1 = X0, X1, X2, …, Xm = X satisfying Xi < Xi+1 and Xi …
Largest prime factor Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 13481    Accepted Submission(s): 4765 Problem Description Everybody knows any number can be combined by the prime number.Now,…
参考链接http://blog.csdn.net/acm_cxlove/article/details/8264290http://blog.csdn.net/w00w12l/article/details/8212782 题意: 首先定义了一种叫做Reverse Prime的数:是一个7位数,倒置后是一个<=10^6的素数(如1000070) 然后要把所有的Reverse Prime求出来,排好序. 然后题目有2种操作: q x :求编号0到编号x的Reverse Prime的质因数个数的和…
HDU 1000 A + B Problem  I/O HDU 1001 Sum Problem  数学 HDU 1002 A + B Problem II  高精度加法 HDU 1003 Maxsum  贪心 HDU 1004 Let the Balloon Rise  字典树,map HDU 1005 Number Sequence  求数列循环节 HDU 1007 Quoit Design  最近点对 HDU 1008 Elevator  模拟 HDU 1010 Tempter of th…
poj3421 X-factor Chains 题意:给定正整数$x(x<=2^{20})$,求$x$的因子组成的满足任意前一项都能整除后一项的序列的最大长度,以及满足最大长度的子序列的个数. 显然最大长度就是$x$的质因数个数(一个一个加上去鸭) 而满足最大长度的子序列个数.... 这不就是可重复元素的全排列吗! 有这么一个公式,设元素总个数$n$,每个重复元素的个数$m_{i}$,共$k$种不同元素 则全排列个数$=\frac{n!}{\prod_{i=1}^{k}m_{i}!}$ 发现$n…
Problem Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct serial number in the range 1..20,000. Unfortunately, he is unaware that the cows interpret some serial numbers as be…
Problem Description Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The position of prime 2 is 1, prime 3 is 2, and prime 5 is 3, etc. Specially, LPF(1) = 0. Inpu…
POj3421X-factor Chains 一开始没读懂题意,不太明白 Xi | Xi+1 where a | b means a perfectly divides into b的意思,后来才发现是要满足后一个数是前一个数的倍数 题目要求1 = X0, X1, X2, …,  Xm = X,并且后一个数是前一个数的倍数,为了得到最长链,必须将数X进行质因数分解, 假设X=(a[1]^b[1])*...*(a[i]^b[i])*..(a[n]^b[n]),设m=b[1]+b[2]+..b[i]…
Max Factor Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 10245    Accepted Submission(s): 3304 Problem Description To improve the organization of his farm, Farmer John labels each of his N (1…