当前位置:网站首页>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;
}边栏推荐
猜你喜欢
随机推荐
常用类以及接口
【mindspore】【Categorical】softmax数据放入Categorical类出现和不为1的错误
电话自动拨号在电脑上自动拨打
TCP协议之《TSQ控制》
一种能让大型数据聚类快2000倍的方法,真不戳
Do you know these basic types of software testing?
day17正则表达式作业
【Verilog数字系统设计(夏雨闻)5-------模块的结构、数据类型、变量和基本运算符号1】
同样是初级测试,凭什么他比我薪资高 5000 块?
Shell 文本三剑客 awk
leetcode 27:移除元素
mindspore安装过程中报错cannot find zlib
TCP协议之《TCP_CORK选项》
How does a new tester do functional testing?Test thinking is really important
【网络迁移】Pytorch中的torch.no_grad对应MindSpore哪个方法
质量小议13 -- 侥幸
@Autowired注解 --required a single bean, but 2 were found出现的原因以及解决方法
继承关系下构造方法的访问特点
c语言进阶篇:动态内存管理(相关函数、常见错误、笔试题)
Dynamic Web Development Fundamentals








