DCP-336: Minimum Base Back to All Problems

Easy Math > Basic Math

In positional notation we know the position of a digit indicates the weight of that digit toward the value of a number.<br> For example, in the base 10 number 123 we know that 3 has the weight 10^0, 2 has the weight 10^1, and 1 has the weight 10^2 yielding the value `1*10^2 + 2*10^1 + 3*10^0` or just `100 + 20 + 3`. <br> The same mechanism is used for numbers expressed in other bases. While most people assume the numbers they encounter everyday are expressed using base 10, we know that other bases are possible. In particular, the number 123 in base 50 or base 20 represents a totally different value than 123 in base 10.<br> In this problem a non-negative number is given and you have to determine what is the **minimum base** is needed to express the number correctly.The base is **between 2 and 62(inclusive)**.To represent a number the digits 0 through 9 have their usual decimal interpretations. The uppercase alphabetic characters A through Z represent digits with values 10 through 35, respectively.The lowercase alphabetic characters a through z represent digits with values 36 through 61, respectively. For example, if the number is 123 then it is assumed that the base will be between 4 and 62(inclusive). But among this 4 is minimum so the answer will be 4.<br> **Note: Answer always exist between base 2 to 62.** Input: ------ Input starts with an integer **T (1<=T<=100)**, denoting the number of test cases. Each case contains a **very big number** having length at most **1000**. Output: ------- For each case of input, print **Case x: answer** Here x is the test case number and answer is the accepted base. See Sample Input and Output for clarifications. Sample Input ------------ 2 123 abc Sample Output ------------- Case 1: 4 Case 2: 39

Problem Setter:

Md. Amir-Al-Fahim

Please login to submit solution to this problem.

Problem Limits

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

Problem Stats




# User Language Timing
01 Durbin Cpp14 0.00s
02 anikatahsin Cpp 0.00s
03 mhiceiuk Cpp14 0.00s
04 ehsan_sshuvo Cpp 0.00s
05 Jisancse Cpp 0.00s
06 emrul Cpp 0.00s
07 Rizon_sunny Cpp 0.00s
08 duronto20 Cpp 0.00s
09 nabil1997 Cpp 0.00s
10 skmonir Cpp 0.00s
11 tariqiitju Cpp 0.00s
12 Najat Cpp 0.00s
13 Superstorm Cpp14 0.00s
14 Nur_Alam39 Cpp 0.00s
15 rohijulislam Cpp 0.00s
16 Pure_Protea Cpp14 0.00s
17 robin_aust Cpp 0.00s
18 Arpan_cse_2k14 Cpp 0.00s
19 shishir09 Cpp14 0.00s
20 The_mover Cpp 0.00s
21 iamsadee Cpp 0.00s
22 pulak_ict_mbstu Cpp14 0.00s
23 belal_mbstu Cpp14 0.00s
24 Anubis Cpp 0.00s
25 yasirnabil534 Cpp14 0.00s
26 Logic_Hunter Cpp14 0.00s
27 burhan103335 Cpp 0.00s
28 Reayz Cpp 0.00s
29 jamil993 Cpp14 0.00s
30 _GhOstMan_ Cpp 0.00s
31 bu_hridoy Cpp 0.00s
32 AlaminJust Cpp 0.00s
33 jewel_ Cpp 0.00s
34 Dhrubo020 Cpp 0.00s
35 Taran Cpp14 0.00s
36 feodorv C 0.00s
37 Rajan_sust Cpp14 0.00s
38 unknown420 Cpp 0.00s
39 jayed_al_hasan Cpp 0.00s
40 aaman007 Cpp 0.00s
41 kissu_pari_na Cpp14 0.00s
42 Bruteforcekid Cpp14 0.00s
43 int_elligent Cpp 0.00s
44 wajiul Cpp 0.00s
45 shakil2021 C 0.00s
46 Bisnu039 Cpp 0.00s
47 cosmicray001 Cpp 0.00s
48 tvirussust Cpp 0.00s
49 by_default Cpp 0.00s
50 baibhavbista Cpp 0.00s

Your feedback is our precious!

Or call +88 02 9853138 for support