标签:
1 #include<iostream> 2 using namespace std; 3 4 int sum_k(int n,int k) 5 { 6 int s=0; 7 while(n!=0) 8 { 9 s+=n%k; 10 n/=k; 11 } 12 return s; 13 } 14 15 int main() 16 { 17 int n; 18 while(cin>>n,n!=0) 19 { 20 int a,b,c; 21 a=sum_k(n,10); 22 b=sum_k(n,12); 23 c=sum_k(n,16); 24 if(a==b&&a==c) 25 cout<<n<<" is a Sky Number."<<endl; 26 else 27 cout<<n<<" is not a Sky Number."<<endl; 28 } 29 return 0; 30 }
标签:
原文地址:http://www.cnblogs.com/wangmengmeng/p/4626938.html