杭电oj2010水仙花数显式wrong answer ,但是vs2010中都正确,高手帮我看一看 5
#include<stdio.h>intmain(void){inti=0,j=0;intm=0,n=0;inta=0,b=0,c=0;intflag=0;while(s...
#include<stdio.h>
int main(void)
{
int i = 0,j = 0;
int m = 0,n = 0;
int a = 0,b = 0,c = 0;
int flag = 0;
while( scanf("%d%d",&m,&n) != EOF)
{
flag = 0;
for(i = m; i < n; i++)
{
a = i / 100;
b = i / 10 - 10 * a;
c = i % 10;
if((a * a * a + b * b * b + c * c * c) == i)
{
flag++;
if(flag > 1)
printf(" %d",i);
else
printf("%d",i);
}
}
if(flag == 0)
printf("no\n");
else
printf("\n");
}
return 0;
} 展开
int main(void)
{
int i = 0,j = 0;
int m = 0,n = 0;
int a = 0,b = 0,c = 0;
int flag = 0;
while( scanf("%d%d",&m,&n) != EOF)
{
flag = 0;
for(i = m; i < n; i++)
{
a = i / 100;
b = i / 10 - 10 * a;
c = i % 10;
if((a * a * a + b * b * b + c * c * c) == i)
{
flag++;
if(flag > 1)
printf(" %d",i);
else
printf("%d",i);
}
}
if(flag == 0)
printf("no\n");
else
printf("\n");
}
return 0;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询