阿姆斯壯數

 avatar
user_3763047219
c_cpp
2 years ago
549 B
2
Indexable
Never
int main()
{
	int a = -1,b = -1;
	int sum = 0,flag=0;
	while (a != 0 && b != 0) {
		scanf("%d %d", &a, &b);
		if (a != 0 && b != 0) {
			for (int i = a; i < b; i++) {
				int i2 = i,i3=0;
				while (i2 >= 1) {
					i3 = i3 * 10 + i2%10;
					i2 = i2 / 10;
				}
				while (i3 >= 1) {
					sum = sum * 10 + (i3 % 10) * (i3 % 10) * (i3 % 10);
					i3 = i3 / 10;
				}
				if (sum == i) {
					flag = 1;
				}
				sum = 0;
			}
			if (flag == 1) {
				printf("有\n");
			}
			else {
				printf("無\n");
			}
		}
		
	}
}