HDOJ 2097
1 #include<stdio.h> 2 int func(int n,int k) 3 { 4 int a,b=0; 5 a=n; 6 while(a!=0) 7 { 8 b+=a%k; 9 a=a/k; 10 } 11 return b; 12 } 13 int main() 14 { 15 int a,b,n; 16 while(scanf("%d",&n)!=EOF&&n) 17 { 18 int x1,x2,x3,x4; 19 x1=func(n,10); 20 x2=func(n,16); 21 x3=func(n,12); 22 if(x1==x2&&x2==x3) 23 printf("%d is a Sky Number.\n",n); 24 else 25 printf("%d is not a Sky Number.\n",n); 26 27 } 28 return 0; 29 }