首页 / 软件开发 / 数据结构与算法 / UVa 10780 Again Prime? No Time.(数论&素因子分解)
UVa 10780 Again Prime? No Time.(数论&素因子分解)2014-04-26 csdn博客 synapse710780 - Again Prime? No Time.Time limit: 3.000 secondshttp://uva.onlinejudge.org/index.php? option=com_onlinejudge&Itemid=8&category=467&page=show_problem&problem=17 21The problem statement is very easy. Given a number n you have to determine the largest power of m, not necessarily prime, that divides n!.InputThe input file consists of several test cases. The first line in the file is the number of cases to handle. The following lines are the cases each of which contains two integers m (1<m<5000) and n (0<n<10000). The integers are separated by an space. There will be no invalid cases given and there are not more that 500 test cases.OutputFor each case in the input, print the case number and result in separate lines. The result is either an integer if m divides n! or a line "Impossible to divide" (without the quotes). Check the sample input and output format.Sample Input22 102 100Sample OutputCase 1:8Case 2:97