当前位置:网站首页>ZZULIOJ:1027: 判断水仙花数
ZZULIOJ:1027: 判断水仙花数
2022-08-10 03:39:00 【追上】
1027: 判断水仙花数
时间限制: 1 Sec 内存限制: 30 MB
[状态] [讨论版] [提交] [命题人:admin]
题目描述
春天是鲜花的季节,水仙花就是其中最迷人的代表,数学上有个水仙花数,他是这样定义的:
“水仙花数”是指一个三位数,它的各位数字的立方和等于其本身,比如:153=13+53+33。
现在要求输入一个三位数,判断该数是否是水仙花数,如果是,输出“yes”,否则输出“no”
输入
输入一个三位的正整数。
输出
输出“yes”或“no”。
样例输入 Copy
153
样例输出 Copy
yes
参考代码
#include <stdio.h>
#include <math.h>
int main()
{
int x, a, b, c;
scanf("%d", &x);
a=x%10;
b=(x/10)%10;
c=(x/100)%10;
if(x==a*a*a+b*b*b+c*c*c)
printf("yes");
else
printf("no");
return 0;
}
边栏推荐
猜你喜欢
随机推荐
program internationalization
Evaluation and Construction of Enterprise Network Security Capability from the Sliding Ruler Model
一篇文章教你Pytest快速入门和基础讲解,一定要看
【网络迁移】Pytorch中的torch.is_tensor对应MindSpore哪个接口
全面深入了解什么是反向代理和负载均衡
一种能让大型数据聚类快2000倍的方法,真不戳
Basic understanding of network models
Haproxy搭建Web群集
GBase 8s迁移失败
TCP协议之《延迟ACCEPT》
数据切片问题
搭建Prometheus+Grafana框架监控Hyperledger Fabric的运行
ThreedLocal在单线程中的应用【获取在拦截器中登录的用户信息】
c语言:通讯录(动态版本)
How does a new tester do functional testing?Test thinking is really important
Embedded Sharing Collection 32
【MindSpore功能】运行SSD-MobileNetV1 FPN样例报错
TCP协议之《Pacing功能》
基础理解网络模型
Pen paper records