Петров Николай Дмитриевич 319/2 AnyPower 2109 | Воробьев Сергей Юрьевич 530 AnyPower 1237 | ||||
---|---|---|---|---|---|
n | 1 | def my_fun(num): | n | 1 | def is_power(n): |
2 | for i in range(2, int(num ** 0.5) + 1): | 2 | for base in range(2, int(n ** 0.5) + 1): | ||
3 | j = i | 3 | temp = base | ||
4 | while j < num: | 4 | while temp <= n: | ||
5 | j *= i | 5 | temp *= base | ||
6 | if j == num: | 6 | if temp == n: | ||
7 | return 'YES' | 7 | return 'YES' | ||
8 | return 'NO' | 8 | return 'NO' | ||
t | 9 | num = int(input()) | t | 9 | n = int(input()) |
10 | print(my_fun(num)) | 10 | print(is_power(n)) |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|