CF1787A.Exponential Equation
普及/提高-
通过率:0%
时间限制:1.00s
内存限制:256MB
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.
给你一个整数 n。
请找出任意一对整数 (x,y)(满足 1≤x,y≤n),使得 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).
第一行包含一个整数 t(1≤t≤104)—— 测试用例的数量。
每个测试用例包含一行,其中有一个整数 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.
对于每个测试用例,如果可行,输出两个整数 x 和 y(1≤x,y≤n)。如有多个答案,输出任意一个即可。
否则,输出 −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.
在第三个测试用例中,23⋅3+32⋅2=42,因此 (2,3) 和 (3,2) 将被视为合法解。
在第四个测试用例中,55⋅5+55⋅5=31250,因此 (5,5) 是一个合法解。
输入解题思路,AI测评打分。不知道怎么写?