您的位置:首页 > 其它

ZOJ 2736 Daffodil number

2016-03-31 22:00 387 查看
E - Daffodil number
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%lld
& %llu
SubmitStatusPracticeZOJ
2736

Description

The daffodil number is one of the famous interesting numbers in the mathematical world. A daffodil number is a three-digit number whose value is equal to the sum of cubes of each digit.

For example. 153 is a daffodil as 153 = 13 + 53 + 33.

Input

There are several test cases in the input, each case contains a three-digit number.

Output

One line for each case. if the given number is a daffodil number, then output "Yes", otherwise "No".

Sample Input

153

610

Sample Output
Yes

No

代码:

#include<iostream>
using namespace std;
int main()
{
int n;
int a,b,c;
while(cin>>n)
{
a=n%10;
b=(n/10)%10;
c=n/100;
if(a*a*a+b*b*b+c*c*c==n)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: