首页 > 代码库 > HDU 2010

HDU 2010

#define _CRT_SECURE_NO_WARNINGS#include <stdio.h>int Is_SXH(int num);int main(){	int in1, in2;	int temp = 0;	int flag = 0;	while (scanf("%d %d", &in1, &in2) != EOF){		flag = 0;		temp = in1;		for (; temp <= in2; temp++){			if (Is_SXH(temp)){				if (flag == 1) printf(" ");				printf("%d", temp);				flag = 1;			}		}		if (flag == 0)			printf("no");		printf("\n");	}}int Is_SXH(int num){	int a1, a2, a3;	a1 = num / 100;	a2 = (num % 100) / 10;	a3 = num % 10;	if ((a1*a1*a1 + a2*a2*a2 + a3*a3*a3) == num)		return 1;	else		return 0;}

  

HDU 2010