Sunday, July 8, 2018

EC_CONB - Even Numbers : Classical

#The solution in Python is as follows:


for _ in xrange(int(raw_input())):
        n=int(raw_input())
        if n%2==0:
                a=bin(n)[2:]
                b=a[::-1]
                print int(b,2)
        else:
                print n


#Keep visiting for more solutions of SPOJ problems in Python 3.Thank you!!!