题目描述
A “daffodil” number is a 3-digits number and it equals to the sum of every digit’s 3 powers.
For example, 153 is a “daffodil” number, because 153=13+53+33
Write a program for determining if a given three digits number is a “daffodil” number.
输入
An integer.
输出
If it is a daffodil number, output “YES”, otherwise output “NO” (excluding quotes)
样例输入 Copy
123
样例输出 Copy
NO
n=int(input())
for i in range(3):
a=n//100
b=n%100//10
c=n%10
s=a**3+b**3+c**3
if s==n:
print('YES')
else:
print('NO')