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 925 (Div. 3) 1931D. Divisible Pairs Solution

    Problem Link  :   https://codeforces.com/contest/1931/problem/D S olution in C++: /// Author : AH_Tonmoy #include < bits / stdc ++. ...

Powered by Blogger.