Friday, December 8, 2017

UVa problem solution 13148 - A Giveaway

problem link:

Discuss:  in this problem i also code like child.just calculate manually cube root and square root and set or condition for special number and simply check just if condition

try your self before see the code



#include<stdio.h>
int main()
{
   //freopen("input.txt","r",stdin);
    //freopen("out.txt","w",stdout);

    long long n,i,j;
    while(scanf("%lld",&n)&&n)
    {
        if(n==1||n==64||n==729||n==4096||n==15625||n==46656||n==117649||n==262144||n==531441||n==1000000||n==17715161||n==2985984)
            printf("Special\n");
        else if(n==4826809||n==7529536||n==11390625||n==16777216||n==24137569||n==34012224||n==47045881||n==64000000||n==85766121||n==1771561)
            printf("Special\n");
        else
            printf("Ordinary\n");
    }
    return 0;
}

No comments:

Post a Comment