Square GG
Time limit1sMemory limit512 MB
Given N, check whether 100N and 100N+1 are both powerful numbers, and print a square-cube form B^2C^3 for each if they are.
- Level
Medium4 of 10
- Topics
- Math, Number theory, Brute force
- Solved
- No attempts yet
Problem
Myungjun could not solve the easy problem 제곱 ㄴㄴ, so he made 제곱ㄱㄱ numbers by reversing the 제곱ㄴㄴ numbers.
A positive integer is called a 제곱ㄱㄱ number if, for every prime factor of , is also a divisor of . The first 제곱ㄱㄱ numbers are 1, 4, 8, 9, 16, 25, 27, 32, ...
Finding a single 제곱ㄱㄱ number is easy, because any perfect power is one. Myungjun also found that every 제곱ㄱㄱ number can be written as a perfect square multiplied by a perfect cube.
Since finding one 제곱ㄱㄱ number of a given size is easy, Myungjun wants to find cases where two consecutive positive integers are both 제곱ㄱㄱ numbers. Help him check whether such a pair exists at the size he wants.
Input
The first line contains an integer ().
Output
Find such that both and are 제곱ㄱㄱ numbers and .
If such an exists, print on the first line two positive integers and with .
On the second line, print two positive integers and with .
If several values of satisfy the condition, print the answer for any one of them.
If no such exists, print -1 on the first line and stop.