杭电acm1197
http://acm.hdu.edu.cn/showproblem.php?pid=1197
简单的进制转化,然后每个位上的数相加,判断如果10,12,16进制的这样的数都相等的话,就输出数字
![](https://images.cnblogs.com/OutliningIndicators/ContractedBlock.gif)
#include <stdio.h> #include<stdlib.h> int main() { int i, n, sum10, sum12, sum16; for (i=2992; i<10000; i++){ n = i; sum10 = 0; while (n){ sum10 += n%10; n /= 10; } n = i; sum12 = 0; while (n){ sum12 += n%12; n /= 12; } n = i; sum16 = 0; while (n){ sum16 += n%16; n /= 16; } if (sum10==sum12 && sum12==sum16) printf("%d\n", i); } system("pause"); return 0; }