zoj 2736 Daffodil number
2024-08-25 04:26:23
Daffodil number
Time Limit: 2 Seconds Memory Limit: 65536 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>
#include <cstdio>
using namespace std;
int main(){
int n, a, b, c;
while(cin >> n){
a = n / ;
b = n % / ;
c = n % ;
if(n == a * a * a + b * b *b + c * c * c)
cout << "Yes" << endl;
else
cout << "No" << endl;
}
return ;
}
最新文章
- 广州PostgreSQL用户会技术交流会小记 2015-9-19
- nodejs-helloword案例
- poj1703 并查集
- 未来十年的十三条思考(FW)
- JPA学习---第十一节:JPA中的多对多双向关联实体定义与注解设置及操作
- SpringMVC + Spring + MyBatis 学习笔记:在类和方法上都使用RequestMapping如何访问
- IE下判断IE版本语法使用
- The kth great number(set)
- Ubuntu配置eclipse
- linux pagecache与内存占用
- PHP中的抽象类与抽象方法/静态属性和静态方法/PHP中的单利模式(单态模式)/串行化与反串行化(序列化与反序列化)/约束类型/魔术方法小结
- 深挖 NPM 机制
- SpringCloud Ribbon的分析(二)
- 通信导论-IP数据网络基础(4)
- 使用海康的某款摄像头以及v4l2的经验
- Intellij IDEA使用Docker插件部署应用
- Lazarus 初识
- 印象深刻的bug
- Java反射、动态加载(将java类名、方法、方法参数当做参数传递,执行方法)
- C#知识点提炼期末复习专用