Number Transformation Codeforces Solution | Codeforces Problem Solution 2022
You are given two integers and . You want to choose two strictly positive (greater than zero) integers and , and then apply the following operation to exactly times: replace with .
You want to find two positive integers and such that becomes equal to after this process. If there are multiple possible pairs, you can choose any of them. If there is no such pair, report it.
For example:
- if and , you may choose and , so that becomes equal to ;
- if and , you may choose and , so that becomes equal to ;
- if and , there is no answer since you cannot decrease with the given operations.
The first line contains one integer () — the number of test cases.
If it is possible to choose a pair of positive integers and so that becomes after the aforementioned process, print these two integers. The integers you print should be not less than and not greater than (it can be shown that if the answer exists, there is a pair of integers and meeting these constraints). If there are multiple such pairs, print any of them.
If it is impossible to choose a pair of integers and so that becomes , print the integer twice.
Join Now for Solution:-
No comments:
Post a Comment