Tuesday, July 28, 2015

1116 - Ekka Dokka

#include<bits/stdc++.h>
using namespace std;
 
int main()
{
    long long T,W,i,c=1;
    scanf("%lld",&T);
 
    while(T--)
    {
        scanf("%lld",&W);
        if(W%2==1)
            printf("Case %lld: Impossible\n",c++);
        else
        {
            for(i=2;;i+=2)
            {
                if(W%i==0 && W/i%2==1)
                {
                    printf("Case %lld: %lld %lld\n",c++,W/i,i);
                    break;
                }
            }
        }
    }
 
    return 0;
}

No comments:

Post a Comment

Triathlon

Triathlon - CodeChef # include < bits/stdc++.h > using namespace std ; # define fi first # define se second # define mp ...