Product of Distinct Integers
Time limit1sMemory limit128 MB
Decide whether n can be expressed as a product of k distinct positive integers.
- Level
Medium7 of 10
- Topics
- Number theory, Greedy, Math
- Solved
- No attempts yet
Problem
Given a positive integer , determine whether it can be written as a product of distinct positive integers.
In other words, decide whether there exist positive integers , all different from one another, such that .
Input
The first line contains a single integer (), the number of test cases.
Each of the next lines contains two integers and (, ), separated by a space.
Output
Print exactly lines. On the -th line print TAK if the -th value can be represented as a product of distinct positive integers, or NIE otherwise.