zoj 2736

 

Daffodil number Time Limit: 1 Second      Memory Limit: 32768 KB

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; while(scanf("%d",&n)!=EOF) { int a = n/100; int b = (n/10)%10; int c = n%10; if(n==(a*a*a+b*b*b+c*c*c)) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0; }

#include <iostream> using namespace std; int main() { int n; while(scanf("%d",&n)!=EOF) { if(n==153||n==370||n==371||n==407) cout<<"Yes"<<endl; else cout<<"No"<<endl; } return 0 ; }

你可能感兴趣的:(c,input,each,output,Numbers)