Light Oj 1116 Ekka Dokka Solution

Solution in C++: 

///**********ALLAH IS ALMIGHTY************///

///AH Tonmoy

///Department of CSE,23rd batch

///Islamic University,Bangladesh  

#include<bits/stdc++.h>

using namespace std;

int main()

{

    long long int t,k=0,odd,v,l, w,i;

    cin>>t;

    while(t--)

    {

        cin>>w;

        k++;

        v=0;

        odd=0;

        l=w/2;

        for(i=2; i<=l; i*=2)

        {

            if(w%i==0)

                odd=w/i;

            if(odd%2==1)

            {

                v=1;

                break;

            }

        }

        if(v==1)

            printf("Case %lld: %lld %lld\n",k,odd,i);

        else

            printf("Case %lld: Impossible\n",k);

    }

}


No comments

Most View Post

Recent post

Codeforces Round 971 (Div. 4) 2009C. The Legend of Freya the Frog Solution

  Problem Link    https://codeforces.com/contest/2009/problem/C S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. h &g...

Powered by Blogger.