CF1787A.Exponential Equation
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given an integer n .
Find any pair of integers (x,y) ( 1≤x,y≤n ) such that xy⋅y+yx⋅x=n .
输入格式
The first line contains a single integer t ( 1≤t≤104 ) — the number of test cases.
Each test case contains one line with a single integer n ( 1≤n≤109 ).
输出格式
For each test case, if possible, print two integers x and y ( 1≤x,y≤n ). If there are multiple answers, print any.
Otherwise, print −1 .
输入输出样例
输入#1
5 3 7 42 31250 20732790
输出#1
-1 -1 2 3 5 5 3 13
说明/提示
In the third test case, 23⋅3+32⋅2=42 , so (2,3),(3,2) will be considered as legal solutions.
In the fourth test case, 55⋅5+55⋅5=31250 , so (5,5) is a legal solution.