Alice is teaching Bob maths via a game called -guesser.
Alice has a positive integer which Bob needs to guess. She gives him two pieces of information with which to do this:
- A positive integer , which denotes the sum of divisors of .
- Two positive integers and , which denote that the sum of reciprocals of divisors of is .
Bob either needs to guess or tell that no such number exists.
It can be shown that if a valid exists, it is unique.
Input Format
- The first line of input contains a single integer , denoting the number of test cases. The description of test cases follows.
- Each test case consists of a single line of input, containing three space-separated integers .
Output Format
For each test case, output a new line containing the answer — Alice's number , or if no such number exists.
Constraints
Sample Input 1
2
4 4 3
4 1 1
Sample Output 1
3
-1
Explanation
Test case : The divisors of are and . Their sum is and the sum of their reciprocals is .
Test case : It can be proved that no positive integer exists whose divisors sum to and reciprocals of divisors sum to .
Solution:
solution link 1
https://shareus.in/?i=yScFNErxQ
if 1st link is not work then click on another link
Solution link 2
Solution link 3
Solution link 4
How to get link tutorial video link
No comments:
Post a Comment