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
代码:
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; }
相关文章推荐
- c++中生成n个m位的随机不重复字符串的一种方法(字母+数字)
- Android 的 SDK Manager 无法启动 闪退解决方法
- 解决Attribute "rippleColor" has already been defined的问题
- Code resource ✵1
- 关于HashMap的ContainsKey()
- 移动端position:fixed小结
- 我的第一篇破壳
- UVA 208 Firetruck
- hadoop生态系统学习之路(五)hbase的简单使用
- js 事件监听封装
- Dubbo框架介绍
- 1007. Maximum Subsequence Sum (25)
- WindowsOptionalFeature 与 WindowsFeature
- HDU 5607 graph(矩阵快速幂)
- Svn+Apache服务器搭建指南
- URAL 1793 Tray 2
- C++第二次实验上机报告(计算标准体重)
- Apache Hadoop2.6.2 小集群搭建
- STL概念
- IOS开发探索(一):CocoalPods相关