CF1787A.Exponential Equation

普及/提高-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given an integer nn.

Find any pair of integers (x,y)(x,y) (1x,yn1\leq x,y\leq n) such that xyy+yxx=nx^y\cdot y+y^x\cdot x = n.

给你一个整数 nn

请找出任意一对整数 (x,y)(x, y)(满足 1x,yn1 \leq x, y \leq n),使得 xyy+yxx=nx^y\cdot y + y^x\cdot x = n

输入格式

The first line contains a single integer tt (1t1041\leq t\leq 10^4) — the number of test cases.

Each test case contains one line with a single integer nn (1n1091\leq n\leq 10^9).

第一行包含一个整数 tt1t1041\leq t\leq 10^4)—— 测试用例的数量。

每个测试用例包含一行,其中有一个整数 nn1n1091\leq n\leq 10^9)。

输出格式

For each test case, if possible, print two integers xx and yy (1x,yn1\leq x,y\leq n). If there are multiple answers, print any.

Otherwise, print 1-1.

对于每个测试用例,如果可行,输出两个整数 xxyy1x,yn1\leq x,y\leq n)。如有多个答案,输出任意一个即可。
否则,输出 1-1

输入输出样例

  • 输入#1

    5
    3
    7
    42
    31250
    20732790

    输出#1

    -1
    -1
    2 3
    5 5
    3 13

说明/提示

In the third test case, 233+322=422^3 \cdot 3+3^2 \cdot 2 = 42, so (2,3),(3,2)(2,3),(3,2) will be considered as legal solutions.

In the fourth test case, 555+555=312505^5 \cdot 5+5^5 \cdot 5 = 31250, so (5,5)(5,5) is a legal solution.

在第三个测试用例中,233+322=422^3 \cdot 3+3^2 \cdot 2 = 42,因此 (2,3)(2,3)(3,2)(3,2) 将被视为合法解。

在第四个测试用例中,555+555=312505^5 \cdot 5+5^5 \cdot 5 = 31250,因此 (5,5)(5,5) 是一个合法解。

输入解题思路,AI测评打分。不知道怎么写?

首页