GOO - Game Of Ones
Haba and Goba are brothers, they love binary numbers very much. Today is Haba’s birthday so, his uncle gifted him a 3 bit binary string. Getting the present, both of them are very happy. Now, Goba asked Haba that using 3 bits how many different binary numbers he can write, whose 1st bit is 1 and total how many 1 will be needed to write those numbers. Haba answered he can write 4 different numbers using 3 bits whose first bit is 1 and those numbers are 4(100), 5(101), 6(110) and 7(111) and to write these 4 numbers in binary he will need 8 ‘1’. Now Goba told Haba that he will tell Haba the length of a binary string n and Haba will have to answer that using n bits how many different binary numbers he can write, whose 1st bit is 1 and total how many 1 will be needed to write those numbers. If Haba can answer correctly he will get more binary strings as present. Haba wants to get more binary string as present but, he doesn’t know the answer of the question of Goba for bigger value of n, so now he wants your help. Help him to find the answer.
Input
The first line contains a positive integer number, t (1≤t≤50) indicating the number of test cases. Each test case contains a positive integer number, n (1≤n≤50) indicating the number of bits.
Output
For each test case you have to output two numbers, whose first and second number indicates the answer of Goba’s first and second question respectively.
Example
Input: 2 2 3 Output: 2 3 4 8
hide comments
sas1905:
2017-06-13 11:19:17
take care of n=1 Last edit: 2017-06-13 13:14:14 |
|
sandeep_4141:
2017-06-09 12:07:28
silly mistake 1st time..take care about n=1 ,cost me one WA!! |
|
amulyagaur:
2017-05-19 08:37:50
derive the formula on paper and the just 3 lines of code will do |
|
anurag_lal1:
2017-02-06 20:09:35
My 100th... Nyc one :)
|
|
amanvars:
2016-07-25 22:59:45
@yamini_96: only 10 lines of code in C++ :) |
|
syed_omar_ali_:
2016-07-22 19:24:23
@yamini_96: Yeah! Young Lady!! |
|
yamini_96:
2016-07-22 18:54:59
30 lines of code in c++....n u r done :D |
|
rishabh_1997:
2016-07-07 11:52:39
Second question since today on Modular Exponentiation..long long int would do.
|
|
amit_taps1997:
2016-07-04 19:27:28
How to Handle Integer Overflow? |
|
Akshat Jain:
2016-06-24 06:59:38
dp or combinatorics...anything will do...
|
Added by: | Rofi |
Date: | 2016-04-27 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 GOSU JS-MONKEY |
Resource: | Own problem. Used in NHSPC 2016 Final Round. |