标签:
Description
Input
Output
Sample Input
Sample Output
1 #include <cstdio> 2 #include <cstring> 3 4 int sum(int n, int m) 5 { 6 int tmp = 0; 7 while(n > 0) 8 { 9 tmp += n % m; 10 n /= m; 11 } 12 return tmp; 13 } 14 15 int main() 16 { 17 #ifdef CDZSC_OFFLINE 18 freopen("in.txt", "r", stdin); 19 freopen("out.txt", "w", stdout); 20 #endif 21 int n, a, b, c; 22 while(~scanf("%d", &n) && n) 23 { 24 a = sum(n, 10); 25 b = sum(n, 16); 26 c = sum(n, 12); 27 printf("%d%s\n", n, (a == b && a == c) ? " is a Sky Number." : " is not a Sky Number."); 28 } 29 return 0; 30 }
标签:
原文地址:http://www.cnblogs.com/LiuACG/p/4246936.html