Sum of powers
Practice
4 (1 votes)
Mathematics
Medium
Open
Approved
Mathamatics
Problem
64% Success 1678 Attempts 30 Points 3s Time Limit 256MB Memory 1024 KB Max Code
You need to find if a number can be expressed as sum of two perfect powers. That is, given x find if there exists non negative integers a, b, m, n such that am + bn = x.
Input
First line of the input contains number of test cases T. It is followed by T lines, each line contains a sinle number x.
Output
For each test case, print "Yes" (without quotes) if the number can be expressed as sum of two perfect powers. Otherwise print "No" (without quotes).
Constraints
1 <= T <= 1000
1 <= x <= 1000000
m > 1, n > 1
Submissions
Please login to view your submissions
Similar Problems
Points:30
8 votes
Tags:
Basic MathPrefixMathObservationC++
Points:30
1 votes
Tags:
MediumStringsSimple-math
Points:30
Tags:
MathematicsMediumOpenApprovedMathamatics
Editorial