410537: GYM104037 B Decode
Memory Limit:0 MB
Time Limit:0 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
B. Decodetime limit per test1.0 smemory limit per test512 MBinputdecode.inoutputdecode.out
Mutitestcases.
You're given three positive integers $$$n_i, e_i, d_i$$$, print two positive integers $$$p_i, q_i$$$, meet $$$n_i = p_i \times q_i$$$ and $$$e_i \times d_i = (p_i - 1)(q_i - 1) + 1$$$.
InputRead from file "decode.in"
First line an integer $$$t$$$ — number of testcases.
Following $$$t$$$ lines, $$$i$$$th contains three integers $$$n_i, d_i, e_i$$$.
OutputOutput to file "decode.out"
Output $$$t$$$ lines, two integers $$$p_i, q_i$$$ as your answer. Note $$$p_i\leq q_i$$$ should hold.
If there are no solutions, pring 'NO'.
ExampleInput10 770 77 5 633 1 211 545 1 499 683 3 227 858 3 257 723 37 13 572 26 11 867 17 17 829 3 263 528 4 109Output
2 385 NO NO NO 11 78 3 241 2 286 NO NO 6 88Note
$$$$$$1\leq t\leq 10^5,1\leq n_i\leq 10^{18},1\leq d_i\times e_i\leq 10^{18},1\leq n_i−e_i\times d_i+2\leq 10^9$$$$$$