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

210/317

Solve/Submission

Ranking

# User Language Timing
01 atik Cpp14 0.00s
02 demon Cpp 0.00s
03 Jakir_Hossain_Sust Cpp14 0.00s
04 KNUTH Cpp 0.00s
05 nafiz0080 Cpp14 0.00s
06 zitul_mahmud Cpp14 0.00s
07 HR_Habib Cpp 0.00s
08 sumon23 Cpp14 0.00s
09 ssavi Cpp14 0.00s
10 absa1am Cpp 0.00s
11 Zayed Cpp14 0.00s
12 aseem_cu Cpp14 0.00s
13 foysal_007 Cpp14 0.00s
14 anikatahsin Cpp14 0.00s
15 badhansen123 Cpp 0.00s
16 mbstu_nitai Cpp14 0.00s
17 Shakil_Mahmud Cpp 0.00s
18 shamimjucse Cpp14 0.00s
19 Mr_adnan Cpp14 0.00s
20 Masum_ice Cpp14 0.00s
21 uzzal_rahman Cpp 0.00s
22 prodipdatta7 Cpp14 0.00s
23 shahincsejnu Cpp 0.00s
24 shishir09 Cpp14 0.00s
25 The_Viper Cpp 0.00s
26 mjtbasif Cpp14 0.00s
27 deder Cpp14 0.00s
28 rayhan50001 Cpp 0.00s
29 mamun_abdullah_iu Cpp 0.00s
30 Sojal Cpp14 0.00s
31 Logic_Hunter Cpp14 0.00s
32 Aizen Cpp 0.00s
33 mir_lutfur_rahman Cpp14 0.00s
34 pulak_ict_mbstu Cpp14 0.00s
35 kakarotto Cpp 0.00s
36 Peregrine_Falcon Cpp14 0.00s
37 afzalul C 0.00s
38 onucsecu Cpp 0.00s
39 Reayz Cpp 0.00s
40 giash_uddin C 0.00s
41 Raka143 Cpp14 0.00s
42 sharifulalam Cpp14 0.00s
43 FariD Cpp14 0.00s
44 mrinmoi Cpp 0.00s
45 bu_hridoy Cpp14 0.00s
46 Sheikh_Fahad Cpp 0.00s
47 Tanvirh Cpp 0.00s
48 Tamim028 Cpp 0.00s
49 feodorv C 0.00s
50 ATIK161 C 0.00s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support