nyoj39水仙花数
来源:互联网 发布:软件租赁报价单模板 编辑:程序博客网 时间:2024/06/05 03:45
#include<stdio.h>
int main()
{
int a=1,b,c;
while(~scanf("%d",&a) && a != 0)
{
b = a;
c = (b%10)*(b%10)*(b%10)+(b/10%10)*(b/10%10)*(b/10%10)+(b/100)*(b/100)*(b/100);
if(c == b)
{
printf("Yes\n");
}
else
printf("No\n");
}
return 0;
int main()
{
int a=1,b,c;
while(~scanf("%d",&a) && a != 0)
{
b = a;
c = (b%10)*(b%10)*(b%10)+(b/10%10)*(b/10%10)*(b/10%10)+(b/100)*(b/100)*(b/100);
if(c == b)
{
printf("Yes\n");
}
else
printf("No\n");
}
return 0;
}
这个题主要是如何循环读入输入的值,关于scanf的理解,scanf主要输入的格式正确返回的是大于一的数。不过这个题我还是没有明白一点,~scanf什么时候需要加上~,这道题我试了试不加~和加上是一样 的。
0 0
- nyoj39水仙花数
- nyoj39(水仙花数)
- nyoj39(水仙花数)
- nyoj39水仙花数
- NYOJ39-水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- 水仙花数
- Lucene5.3.1之helloworld demo
- &与&&区别
- 什么是前同步码 (preamble) http://www.blogbus.com/sunnyleevip-logs/160791598.html
- tkinter绑定鼠标滚轮滚动事件
- XCode7以上免证书真机调试教程
- nyoj39水仙花数
- 关于CoreLocation定位服务的简单使用
- Quartus Ⅱ的原型机上的cpu指令开发
- chrome浏览器默认搜索栏一直加载的问题
- Camera中对焦模式总结
- (NO.00002)iOS游戏精灵战争雏形(六)
- 喝液氮是一种什么样的体验
- 3-4 计算长方形的周长和面积--SDUT
- POJ-2390