路过,膜拜9楼。。。
程序代码:#include <stdio.h>
#define get(value, digit) ((value) / (digit) % 10)
int main(void) {
int i, one, ten, hundred;
for(i = 100; i < 1000; i++) {
one = get(i, 1);
ten = get(i, 10);
hundred = get(i, 100);
if(one > hundred && hundred > ten && (one + ten + hundred) == (one * ten * hundred))
break;
}
printf("%d\n", i);
return 0;
}
/* Output:
213
Process returned 0 (0x0) execution time : 0.016 s
Press any key to continue.
*/










没有考虑效率
好像又学到了点东西
“且个位数字之和等于个位数字之积”?是“个位数等于百位、十位、个位之积”吗?