DCP-216: Math is Fun Back to All Problems

Easy Math > Number Theory

**Ashik** is a little boy. He reads in class 3. He is a very good student and also very good in math. One day he was in his class. The lesson was about divisibility. So teacher taught them how to find out the divisibility of numbers. **Then teacher gave them a number containing exactly one alphabetic character.** There are some possible values of that alphabetic character so that the whole number is divisible by 3. This problem was only solved by the brilliant boy Ashik. Are you as brilliant as Ashik !? Yeah I think so. Now it's your task to find out **the shortest possible value of that alphabetic character for which the total number is divisible by 3.** ***Possible value should be 1 to 9***. ***Note: Solution will always exists and will be between 1 to 9.*** Input: ------ First line contains **T(1<=T<=100)** denoting the number of test cases. The following **T** lines contain a number , say **S**, containing ***exactly one character*** with length **|S| (1<=|S|<=50).** The number must contain a alphabetic character. Output: ------- For each case print the case number first and then **print the value of that particular alphabetic character**. See the sample input output for details. Sample Input ------------ 3 101A 099D567 1153498283B673 Sample Output ------------- Case 1: 1 Case 2: 3 Case 3: 3 **Explanation:**<br> In case 1, If you replace A in 101A with 1 ,then number will be 1011, which is divisible by 3 i.e 1011%3=0.

Problem Setter:

Md.Ashraful Islam Shohag

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

Problem Stats




# User Language Timing
01 lsiddiqsunny Cpp14 0.00s
02 hrOarr Cpp14 0.00s
03 pulak_ict_mbstu Cpp14 0.00s
04 Mr_adnan Cpp14 0.00s
05 badhansen123 Cpp 0.00s
06 FariD Cpp14 0.00s
07 KNUTH Cpp 0.00s
08 DynamicOvi Cpp14 0.00s
09 Reayz Cpp 0.00s
10 Bruteforcekid Cpp14 0.00s
11 Zayed Cpp14 0.00s
12 bu_hridoy Cpp14 0.00s
13 kakarotto Cpp 0.00s
14 mir003 Cpp 0.00s
15 prodipdatta7 Cpp14 0.00s
16 lazarus94 Cpp14 0.00s
17 Jakir_Hossain_Sust Cpp14 0.00s
18 sadat999 Cpp14 0.00s
19 SakibAlamin Cpp14 0.00s
20 Tamim028 Cpp 0.00s
21 AlaminJust Cpp14 0.00s
22 Masum_ice Cpp14 0.00s
23 atik Cpp14 0.00s
24 shamimjucse Cpp14 0.00s
25 anikatahsin Cpp14 0.00s
26 Logic_Hunter Cpp14 0.00s
27 susmoys Cpp14 0.00s
28 Raka143 Cpp14 0.00s
29 onucsecu Cpp 0.00s
30 uzzal_rahman Cpp 0.00s
31 lolcoder Cpp14 0.00s
32 aseem_cu Cpp14 0.00s
33 ATIK161 C 0.00s
34 nazmul_bzs Cpp14 0.00s
35 shahincsejnu Cpp 0.00s
36 deder Cpp14 0.00s
37 kowsher66 Cpp14 0.00s
38 mbstu_nitai Cpp14 0.00s
39 jayed_al_hasan Cpp14 0.00s
40 sumon23 Cpp14 0.00s
41 Rijwan_Hossain Cpp 0.00s
42 Sojal Cpp14 0.00s
43 Bisnu039 C 0.00s
44 gulzar Cpp 0.00s
45 Peregrine_Falcon Cpp14 0.00s
46 ismail_cse15 Cpp 0.00s
47 Shakil_Mahmud Cpp 0.00s
48 azizsabuj Cpp14 0.00s
49 giash_uddin C 0.00s
50 mjtbasif Cpp14 0.00s

Your feedback is our precious!

Or call +88 02 9853138 for support