2011-12-14 05:33:58
地址:
题意:中文,进制转换。
代码:
# includeint base(int n, int b) { int sum = 0 ; while (n) { sum += n%b ; n /= b ; } return sum ; } int main () { int n ; while (~scanf ("%d", &n) && n) { if (base(n,10) == base(n,12) && base(n,10) == base(n,16)) printf ("%d is a Sky Number.\n", n) ; else printf ("%d is not a Sky Number.\n", n) ; } return 0 ; }