DCP-539: Kufaland Back to All Problems

Easy Beginners Problems > Ad-hoc


The day when **kufaland** was created , God left it with **exactly one** kufa. Kufas are mysterious creature, they can **double** their population in a day. But more than that, They cause unexpected accident in a very unexpected way. Calendar of kufaland is started from the day it’s been created. So kufaland is created at day 0 according their calendar. Very second day (day 1) in the land, there was 2 kufa and they made a very big mistake. God cursed them , so they can never grow their population. Whenever population exceed 6 (population become &ge; 7) , 7 of them dies immediately. Kufas hired you to find what is the population of ith day according their calendar? Input: ------ Input starts with an integer **T (1<=10<sup>5</sup>)**, denoting the number of test cases. Each case contains an integer **D (0≤ D ≤ 10<sup>18</sup>)** denoting the Date of kufaland calendar. Output: ------- For each test case , output a single integer in a line, the population of kufaland at D'th day. Sample Input ------------ 2 0 10 Sample Output ------------- 1 2


Problem Setter:

Md. Tariqul Islam

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# 1.00
Go 1.00
Java 1.00
JavaScript 1.00
Objective-C 1.00
Perl 1.00
PHP 1.00
Python 1.00
Python3 1.00
Ruby 1.00
VB.Net 1.00

Problem Stats

162/301

Solve/Submission

Ranking

# User Language Timing
01 sourav_malo C 0.02s
02 rakibislam1996 Cpp14 0.02s
03 prottoy919 Cpp 0.02s
04 Rev_2 Cpp 0.02s
05 tahsin_protik C 0.02s
06 Arnob114348 C 0.02s
07 afridi13 Cpp 0.03s
08 Riz1ahmed Cpp 0.03s
09 emrul Cpp 0.03s
10 leenaiitju Cpp 0.03s
11 sajjad_h Cpp 0.03s
12 ssavi Cpp 0.03s
13 shishir09 Cpp14 0.03s
14 feodorv C 0.03s
15 ehsan_sshuvo96 Cpp 0.03s
16 mhiceiuk Cpp 0.03s
17 acwatlerte Cpp 0.03s
18 5h4n70 Cpp 0.03s
19 Taran Cpp 0.03s
20 sazzad786 Cpp 0.03s
21 Masum_ice Cpp 0.03s
22 fayedanik Cpp 0.03s
23 hassanmdsifat Cpp 0.03s
24 Ramprosad Cpp 0.03s
25 sakib_ruet_13 Cpp 0.03s
26 rohijulislam Cpp 0.03s
27 shaeekh Cpp 0.03s
28 iamsadee Cpp 0.03s
29 Dragon_Curve Cpp 0.03s
30 Ishraq_Nibir Cpp 0.03s
31 kissu_pari_na Cpp14 0.03s
32 orpib Cpp 0.03s
33 SbrTa Cpp14 0.03s
34 astrolion7 Cpp14 0.03s
35 prodipdatta7 Cpp14 0.03s
36 Himon_PUST Cpp 0.03s
37 dot0 Cpp14 0.03s
38 shoumo Cpp14 0.03s
39 pulak_ict_mbstu Cpp14 0.03s
40 mh755628 Cpp 0.03s
41 spectro30 Cpp14 0.03s
42 Reayz Cpp 0.03s
43 prateepm Cpp14 0.03s
44 shuvo_mbstu Cpp 0.03s
45 robin_aust Cpp 0.04s
46 mash02 Cpp 0.04s
47 t0whid Cpp 0.04s
48 fuad036 Cpp 0.04s
49 rahathossain690 Cpp 0.04s
50 dysnomia C 0.04s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support