HDU ACM 11 2097 Sky数

来源:互联网 发布:归并排序java实现 编辑:程序博客网 时间:2024/05/21 21:43
#include <iostream>using namespace std;int main(){int n;while (cin >> n && n){int Lu = 0, Hui = 0, Yi = 0;int x = n;while (x){Lu += x%16;x = x/16;}x = n;while (x){Hui += x%12;x = x/12;}x = n;while (x){Yi += x%10;x = x/10;}if (Lu == Yi && Lu == Hui)cout << n << " is a Sky Number.\n";elsecout << n << " is not a Sky Number.\n";}return 0;}

0 0
原创粉丝点击