Submit | All submissions | Best solutions | Back to list |
INS16H - Daenerys wants to Conquer |
With full zeal, Daenerys Targaryen is looking to conquer the seven kingdoms. In need of wise commanders, she wants them to solve the below problem:
Given the following function F and an integer N find the smallest integer x satisfying F(x) = N.
If no such x exists, print “-1”. (without quotes)
Input Format:
The first line contains one integer T, the number of times she gives you the problem.
T lines follow, each containing a single integer N.
Output Format:
Print the answer for each problem in a separate line.
Constraints:
1 ≤ T ≤ 10
1 ≤ N ≤ 1010
Sample Input:
4
5
4
9
7
Sample Output:
4
3
8
-1
Added by: | Adarsh kumar |
Date: | 2016-04-10 |
Time limit: | 0.200s-1.200s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | INSOMNIA 2016 |
hide comments
2018-05-22 07:39:56 [Trichromatic] XilinX
F(x) can be find by the following PS-eudo code: function f(x){ ret = 0 for d = 1..x: if (x mod d == 0) and (gcd(d, x/d) == 1): ret += d return ret; } |
|
2018-05-22 05:00:32
The image with the actual function is missing - completely unsolvable without it. Edit: I managed to find it http://www.image-maps.com/m/private/0/gh741aeuifi28iqd8u2995i5a0_pv4ua.jpg |