水仙花数
来源:互联网 发布:python交互式编程导论 编辑:程序博客网 时间:2024/05/16 17:13
#include <stdio.h>
#include <math.h>
int main()
{ int m, n, a, b, c, l;
while(scanf("%d %d", &m, &n)!=EOF)
{
l=1;
for(m=m;m<=n;m++)
{
a=m/100;
b=(m%100)/10;
c=(m%100)%10;
if(m==a*a*a+b*b*b+c*c*c)
{
if(l==1)
printf("%d",m);
else
printf(" %d",m);
l++;
}
}
if(l==1)
printf("no");
printf("\n");
}
return 0;
}
#include <math.h>
int main()
{ int m, n, a, b, c, l;
while(scanf("%d %d", &m, &n)!=EOF)
{
l=1;
for(m=m;m<=n;m++)
{
a=m/100;
b=(m%100)/10;
c=(m%100)%10;
if(m==a*a*a+b*b*b+c*c*c)
{
if(l==1)
printf("%d",m);
else
printf(" %d",m);
l++;
}
}
if(l==1)
printf("no");
printf("\n");
}
return 0;
}
阅读全文
0 0
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 卷积神经网络物体检测之感受野大小计算
- 合并果子(堆模板)
- Android四大组件之Activity篇
- myeclipse 中build path 和 deployment assembly的区别?
- 【开源云要闻回顾】Ubuntu 新版启动开发、Python 成第二受欢迎语言......
- 水仙花数
- spark-alluxio生产环境的应用与实践
- The superclass "javax.servlet.http.HttpServlet" was not found on the Java Build Path报错
- 解决inline、inline—block之间空隙问题
- JAVA_String
- Ubuntu 16.04 利用qemu模拟ARM开发板
- 职场生涯
- apache中关于目录访问权限设置
- Eclipse常用快捷键 手指不离键盘