CF1787A.Exponential Equation

普及/提高-

通过率:0%

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 .

输入格式

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 ).

输出格式

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 .

输入输出样例

  • 输入#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.

首页