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

Your feedback is our precious!

Or call +88 02 9853138 for support