1010:“水仙花数”问题1
来源:互联网 发布:emlog源码下载 编辑:程序博客网 时间:2024/05/20 16:00
1010:“水仙花数”问题1
Description
判断一个数是否为“水仙花数”,所谓“水仙花数”是指这样一类数:其各位数字的立方和等于该数本身。例如:371是一个“水仙花数”,371=3^3+7^3+1^3.
Input
一个三位数
Output
1或者0(1代表此数为水仙花数,0代表此数不是水仙花数)
Sample Input
371
Sample Output
1
Source
#include<iostream>using namespace std;int main(){ int n; int a,b,c,d; cin>>n; a=n/10; b=a%10; c=a/10; d=n%10; if(d*d*d+b*b*b+c*c*c==n) cout<<"1"; else cout<<"0"; return 0;}
阅读全文
0 0
- 1010: "水仙花数"问题1
- 1010:“水仙花数”问题1
- 水仙花数的问题
- 水仙花数问题
- C++ 水仙花数问题
- acm水仙花数问题
- 水仙花数问题
- “水仙花”数的问题
- 水仙花数问题
- 水仙花数问题
- ”水仙花数“问题 Narcissistic Number
- 1011: "水仙花数"问题2
- (水仙花数问题)假设100
- 1011:"水仙花数”问题2
- 三位水仙花数1
- 2-1 水仙花数
- 习题2-1 水仙花数
- java 水仙花数的问题小程序
- iOS进阶之巧用IBInspectable属性和IB_DESIGNABLE宏定义
- linux系统性安装mysql服务器(基于CentOS)
- HTML&CSS基础篇之十五:表格&列表
- 【POJ】2362 Square(DFS)
- 完整css选择器总结
- 1010:“水仙花数”问题1
- libsvm正则化和liblinear正则化的区分
- 我的工作——认知
- explain mysql详解
- Mybatis的<where><foreach><set><trim>等标签详解
- banner图片轮播
- lua解析树形字符串拼接问题
- shell中各种括号的作用()、(())、[]、[[]]、{}
- oracle 中translate的基本用法