loj#P3232. 「POI2019 R1」Najmniejsza wspólna wielokrotność
「POI2019 R1」Najmniejsza wspólna wielokrotność
Description
Source Problem: POI XXVII - I etap (Najmniejsza wspólna wielokrotność)
Byteasar is studying for a maths test which will focus on determining the least common multiple. Recall that the least common multiple (lcm) of integers is the least positive integer d such that each of is its divisor. For example, , whereas .
Byteasar quickly mastered the standard exercises, and found the subject so amusing that he started inventing tasks of his own. Let us find out if you are able to solve one of those.
For a given positive integer you are to return an interval of positive integers such that the least common multiple of all the integers in it is exactly . The interval has to contain at least two positive integers.
To thoroughly test your skills, Byteasar will ask you (or rather your program) multiple queries.
Input Format
In the first input line there is a single integer which specifies the number of Byteasar’s queries. The next lines specify the queries, one per line. Each query is specified by a single integer .
Output Format
Your program should print exactly lines to the standard output. The -th of these should contain the answer to the -th Byteasar’s query. An answer to a query consists of two positive integers and , separated by a single space, which stand for the interval of integers .
If no interval satisfies the desired property, the single word NIE
(Polish for no) should be printed instead of any numbers.
If there is more than one answer, report the one with minimum , breaking ties (if any) in favor of smaller .
3
12
504
17
1 4
6 9
NIE
Additional Samples
See files nww/nww*.in
and nww/nww*.out
for additional samples.
Additional Sample 1: five values: , , , , and , Additional Sample 2: single value: , Additional Sample 3: single value: , Additional Sample 4: , the values of alternate between and .
Constraints
Subtask # | Additional Constraints | Score |
---|---|---|