标签:
Description
Input
Output
Sample Input
Sample Output
1 #include<cstdio> 2 #include<cstring> 3 int main() 4 { 5 int n,m; 6 while(scanf("%d",&n)&&n!=0) 7 { 8 m=n; 9 int num0=0; 10 while(m>0) 11 { 12 num0+=m%10; 13 m/=10; 14 } 15 m=n; 16 int num1=0; 17 while(m>0) 18 { 19 num1+=m%16; 20 m/=16; 21 } 22 m=n; 23 int num2=0; 24 while(m>0) 25 { 26 num2+=m%12; 27 m/=12; 28 } 29 if(num1==num0&&num1==num2) 30 { 31 printf("%d is a Sky Number.\n",n); 32 } 33 else 34 { 35 printf("%d is not a Sky Number.\n",n); 36 } 37 } 38 }
标签:
原文地址:http://www.cnblogs.com/guofeng1022/p/4246347.html