DCP-103: Make Sixovisible Back to All Problems

Medium Divide and Conquer > Dynamic Programming


You are given an integer N. You are allowed to remove zero or more digits from N such that the sum of the remaining digits is maximum and N becomes divisible by 6. You can remove digits from N till it has at least one digit. Input: ------ Input starts with an integer T (T ≤ 100) denoting the number of test cases. Each case contains an integer N (N > 0). Number of digits in N does not exceed 500. Output: ------- For each case, print the case number (starting from 1) and the sum of digits in resulting N. If no solution exists, print “Impossible” without the quotes. Sample Input ------------ 5 124 3552 99912137 82113 10 Sample Output ------------- Case 1: 6 Case 2: 15 Case 3: 30 Case 4: Impossible Case 5: 0


Problem Setter:

Ariful Hoque Maruf

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

43/175

Solve/Submission

Ranking

# User Language Timing
01 sakib_muhit Cpp14 0.00s
02 feodorv C 0.00s
03 Tahmid Cpp14 0.00s
04 SakibAlamin Cpp14 0.00s
05 haasib Cpp 0.00s
06 Ishrak Cpp 0.00s
07 Morass Cpp14 0.01s
08 prodipdatta7 Cpp14 0.01s
09 prateepm Cpp14 0.01s
10 umli Cpp 0.02s
11 robin_aust Cpp 0.07s
12 tariqiitju Cpp 0.12s
13 murad_al_wajed Cpp 0.14s
14 mh755628 Cpp 0.16s
15 _dipu Cpp14 0.17s
16 moinul_shaon Cpp14 0.27s
17 Sarwar05 Cpp 0.34s
18 dipta007 Cpp14 0.36s
19 alhelal_cse Cpp14 0.39s
20 dark_coderf Cpp14 0.40s
21 Nirjhor Cpp14 0.45s
22 rubabredwan Cpp14 0.46s
23 mamun4122 Cpp14 0.47s
24 sahedsohel Cpp14 0.49s
25 Pure_Protea Cpp14 0.49s
26 smjlord068 Cpp14 0.50s
27 Skyfall009 Cpp14 0.51s
28 gamerrishad Cpp14 0.52s
29 jahid_ict Cpp14 0.57s
30 raihatneloy Cpp14 0.58s
31 swapnil Cpp14 0.63s
32 Tanmoy1228 Cpp14 0.70s
33 SIR_MBSTU Cpp14 0.73s
34 froghramar Cpp14 1.19s
35 sohag_hstu Cpp14 1.35s
36 njrafi Cpp14 1.84s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support