View Code of Problem 3805

#include <cstdio>
#include <iostream>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;

typedef long long ll;
#define MAXN 200010
#define INF 0x3f3f3f3f
const int mod=1000000009;

int n;

int main()
{
    while(~scanf("%d",&n))
    {
        if(!n) break;
        int a=0,b=0,c=0;
        int tmp;
        tmp=n;
        while(tmp)
        {
            a+=tmp%10;
            tmp/=10;
        }
        tmp=n;
        while(tmp)
        {
            b+=tmp%16;
            tmp/=16;
        }
        tmp=n;
        while(tmp)
        {
            c+=tmp%12;
            tmp/=12;
        }
        if(a==b&&b==c)
            printf("%d is a GOD number.\n",n);
        else printf("%d is not a GOD number.\n",n);
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 3805