PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000236. Tổng hai lập phương (Sum of Cubes)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Tổng hai lập phương (Sum of Cubes)
Sum of Cubes
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given a positive integer , decide whether it equals for some positive integers . The integers may be equal but neither may be zero. For example, .
Input
The only line contains positive integer .
Output
Print YES if such a pair exists, otherwise print NO.
Subtasks
- Subtask 1 (20 points): .
- Subtask 2 (30 points): .
- Subtask 3 (50 points): .
Examples
Input
28
Output
YES
Explanation
and sum to 28. Both integers are positive.
Input
27
Output
NO
Explanation
Positive cubes at most 27 are 1, 8 and 27. A summand of 27 already leaves no room for a positive second summand. The remaining sums are 2, 9 and 16.