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

RESTful APIs with CRUD Operations in Laravel 12| (2025)

  RESTful APIs serve as the foundation of modern web development. They follow a set of rules called Representational State Transfer (REST) t...

Powered by Blogger.