IAPCR2D - Find The Number
Finding the number of all divisor of a number is too easy. But don’t worry, this problem is also quite easy.
You will be given the number of all divisor of the factorial of a number, you will have to find number. If there are multiple such number, you will have to find the smallest one. If there is no such numbers that meets the constraint print “nai”.
The first line of the input will be T, denoting number of test cases. In the following T lines there will be only one integer N, denoting the number of all divisor of the factorial of a number X. It is guaranteed that X will be less than 10^2 + 10.
1 <= t <= 10^5
0 <= n <= 10^18
1 <= X < 10^2 + 10
For each test case print the number X. If X does not exists or is greater than 10^4 then print "nai" (without the quotes) in a single line. Follow the sample input/output.
Input: 5 1 2 3 4 5 Output: 1 2 nai 3 nai
precomputation + binary search works....plz consider n=0...it costed me 3 wa's
n=0 costed 3 WAs!!
Ahh, mixed feelings because my python solution did not pass but pypy solution passed. Too lazy to look for optimizations on such easy problem. :/
How to do it in 0.00 ? It took me 0.02 sec with precomputation+log nLast edit: 2016-06-15 20:12:02
n can be greater than 10^18.
If X is guranteed to be less than 10^2+10, why do we have to print nai for X>10^4!
how do you precompute factorials of 110 and all? could someone help here?
Francky: I got AC with assumption that it is simply 110.
Is there a typo, or 10^2 + 10 is simply 110 ?