All problems

Problem 805

Perfect Cube Check

Easy · 10 pts · Math, Basics, Binary Search

Problem

Decide whether a non-negative integer N is a perfect cube, that is, N = K × K × K for some integer K. Floating-point cube roots can be slightly off for large numbers, so check the integers around the rounded cube root, or binary search for K between 0 and 10^6. Note that 0 and 1 are perfect cubes. The numbers in this problem can be larger than a 32-bit int can hold (about 2.1 × 10^9), so use a 64-bit integer type: long long in C++, long in Java (Python needs nothing special).

Input

A single integer N.

Output

Print YES if N is a perfect cube, otherwise NO.

Constraints

0 <= N <= 10^18

Example input

27

Example output

YES

Explanation

27 = 3 × 3 × 3, so it is a perfect cube and the answer is YES. 26 is not.

Every problem here can be used in a RelayTrixCode team match. Create a room.

Previous: ASCII Value of a Character Next: Last Digit of a Number