All submissions for this problem are available.
Since sea trading has slowed down, pirates of the caribbean have turned into crackers.One day, Jack and Barbossa bet a PS4 and a Xbox on creating the fastest program to identify the most significant bit of a binary number obtained from a decimal input.
Jack forgot the basics and now needs your help.
If you know how to convert decimal to binary, then skip to input.
An easy method of converting decimal to binary number equivalents is to write down the decimal number and to continually divide-by-2 (two) to give a result and a remainder of either a “1” or a “0” until the final result equals zero.So for example. Convert the decimal number 294 into its binary number equivalent. Number 294 divide by 2 result 147 remainder 0 divide by 2 result 73 remainder 1 divide by 2 result 36 remainder 1 divide by 2 result 18 remainder 0 divide by 2 result 9 remainder 0 divide by 2 result 4 remainder 1 divide by 2 result 2 remainder 0 divide by 2 result 1 remainder 0 divide by 2 result 0 remainder 1 <(MOST SIGNIFICANT BIT) So this gives the decimal number 294 an equivalent of 100100110
First line contains ‘T’, the number of test cases. Each test case is given on a new line, which consists of the Decimal number 'N'.
For each test case output the Most significant bit of it's binary equivalent
1 ≤ T ≤ 10001
0 ≤ N ≤ 10^9
Input: 1 294 Output: 1
Explained in the problem description section
|Time Limit:||0.01 sec|
|Source Limit:||50000 Bytes|
|Languages:||C, CPP14, JAVA, PYTH, PYTH 3.6, PYPY, CS2, PAS fpc, PAS gpc, RUBY, PHP, GO, NODEJS, HASK, SCALA, D, PERL, FORT, WSPC, ADA, CAML, ICK, BF, ASM, CLPS, PRLG, ICON, SCM qobi, PIKE, ST, NICE, LUA, BASH, NEM, LISP sbcl, LISP clisp, SCM guile, JS, ERL, TCL, PERL6, TEXT, SCM chicken, PYP3, CLOJ, FS|
Fetching successful submissions
If you are still having problems, see a sample solution here.