HDU 2088 Sky數

#include<stdio.h>

int main()
{
    int n;
    int temp;
    while (scanf("%d", &n), n)
    {
        int a[3][2] = {10, 0, 16, 0, 12, 0};
        for (int i = 0; i < 3; i++)
        {
            temp = n;
            while(temp)
            {
                a[i][1] += temp % a[i][0];
                temp /= a[i][0];
            }
        }
        if (a[0][1] == a[1][1] && a[1][1] == a[2][1])
            printf("%d is a Sky Number.\n", n);
        else
            printf("%d is not a Sky Number.\n", n);
    }
    return 0;
}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章