DCP-374: Bit Need Back to All Problems

Easy Beginners Problems > Ad-hoc


You have given an integer number , you have to find the ***minimum total number of bits*** needed to represent it in binary number system.<br> For example, integer 7 is represented in binary form as : 111 So, it needs minimum 3 bits to represent it. Input: ------ Input starts with an integer **T ( 1<=T<=200000 )**, denoting the number of test cases. Each case contains an integer **N (0 ≤ N ≤ 10^18)** denoting the number. Output: ------- For each case of input, output the minimum number of bits needed to represent that number in binary format. Sample Input ------------ 2 1 7 Sample Output ------------- 1 3 Explanation: For case 1: Integer 1 can be represented in binary number as "0001" ,"01", "1" and so on.But, to represent 1 as "1", only 1 bit is needed, which is minimum. so answer is 1.


Problem Setter:

Bishal Gautam

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats

186/537

Solve/Submission

Ranking

# User Language Timing
01 FariD Cpp14 0.02s
02 I_See_You Cpp 0.03s
03 Morass Cpp14 0.03s
04 Sarwar05 Cpp 0.05s
05 feodorv C 0.05s
06 jualahmed Cpp 0.05s
07 ss1230 Cpp 0.05s
08 jayed_al_hasan Cpp 0.05s
09 ammasum Cpp 0.05s
10 trifiasco Cpp 0.05s
11 SakibAlamin Cpp14 0.05s
12 ainan_ahmed Cpp14 0.05s
13 Mahadi024 Cpp14 0.05s
14 cse_nazmul Cpp 0.05s
15 Gang_Of_Three_01 Cpp 0.05s
16 Saimum_140128 Cpp 0.05s
17 haasib Cpp 0.05s
18 tariqiitju Cpp 0.05s
19 saiful130104 Cpp 0.05s
20 atqrhmn Cpp 0.05s
21 marineCoder Cpp 0.05s
22 nasib_mbstu Cpp 0.05s
23 tlcakash Cpp 0.05s
24 isakib Cpp 0.05s
25 mh755628 C 0.05s
26 iridescentAurora131 Cpp 0.05s
27 souravahmed C 0.06s
28 afzalul C 0.06s
29 Logic_Hunter Cpp 0.06s
30 pulak_ict_mbstu Cpp 0.06s
31 Aman_khan Cpp 0.06s
32 t0whid Cpp 0.06s
33 robin_aust Cpp 0.06s
34 shishir09 Cpp14 0.06s
35 arabin C 0.06s
36 Nazmul_WUB Cpp 0.06s
37 ssavi Cpp 0.06s
38 subhashis_cse Cpp 0.06s
39 zitul_mahmud Cpp 0.06s
40 iammarajul C 0.06s
41 Bisnu039 C 0.06s
42 kissu_pari_na Cpp 0.06s
43 Akram_H_RIckon C 0.06s
44 haliban_25 C 0.06s
45 CrackerJack Cpp 0.06s
46 nurul_islam Cpp 0.06s
47 anik_JU Cpp 0.06s
48 yakin Cpp 0.07s
49 FahimSifnatul Cpp 0.07s
50 sazal_dev Cpp 0.07s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support