# DCP-41: Innovative Birthday Gift! Back to All Problems

Easy Math > Number Theory

Tom and Jerry are not just any normal boys like others in their class. They are the best programmers in their class. Today is their birthday. So Mike decided to gift something on their birthday. As they happen to be well known programmers, Mike thought of something innovative. He sent an encrypted message to them in which the instruction for finding the gift has been written. If they desire to get their birthday gift, they have to decode the message given in the message and follow the instructions given in the message. The nature of encryption is described below: Prime numbers the positive integers which are only divisible by 1 and surely, number itself. The first of this kind is 2, then comes 3, 5, 7….. and so on. The ith letter of the original message is represented by a number ai. Let *m* is the nearest prime number less than or equal to *ai*. Now if *m* is the *r* th prime (like 2 is the 1st prime, 3 is the 2nd prime), the decoded letter would be ((*r* modulo 26)+1) th lowercase letter in the alphabet. A ‘0’ represents a space (' ') and '-1' represents a period ('.'). For example, let the encoded message contains three numbers like 12 17 -1. The nearest prime less than or equal to 12 is 11. 11 is the 5th prime. (5 modulo 26)+1=6. The 6th letter is ‘f’. Similarly 17 is the 7th prime and (7 modulo 26)+1=8. So the letter is ‘h’. Therefore, the decoded message for the sequence ‘12 17 -1’ represents “fh.”. You need to decode the message and help them get their birthday gift. Input: ------ The first line of input contains *t*, the number of test cases (1<=*t*<=10). For each of next *t* cases, there is a number *n* (1<=*n*<=100) which is followed by *n* space separated integers ai (-1<=*ai*<10000). Output: ------- Print the decrypted messages in separate lines. Sample Input ------------ 2 18 3324 0 6791 7741 3798 6883 8161 0 1873 3254 6302 373 7688 0 7151 7229 6842 -1 13 8707 7452 19 1224 0 3182 9161 0 8804 4391 5867 5280 -1 Sample Output ------------- a quick brown fox. this is easy.

### Problem Limits

 Language Time Limit (seconds) C/C++ 1.00 Java 1.00 C# 1.00 PHP 1.00

# 97/121

Solve/Submission

### Ranking

# User Language Timing
01 mahrahat Cpp 0.00s
03 emrul Cpp 0.01s
04 Ansarul_14 Cpp 0.01s
05 nazmul_bzs Cpp 0.01s
06 anis Cpp 0.07s
07 Najat Cpp 0.07s
08 Md_Abid Cpp 0.09s
09 zifan Cpp 0.22s
10 khayrul Cpp 0.25s
11 Gias_uddin Cpp 0.26s
12 abinash Cpp 0.27s
13 mtmohim Cpp 0.28s
14 Anik7703 Cpp 0.31s
15 talha629 Cpp 0.32s
16 mamun4122 Cpp 0.34s
17 jahid_ict Cpp 0.40s
18 Digonta Cpp 0.40s
19 sajal_khan Cpp 0.40s
20 howcum Cpp 0.40s
21 shaheen_bd Cpp 0.40s
22 BinaryFlip Cpp 0.40s
23 Unseen Cpp 0.40s
25 kanon2 Cpp 0.40s
26 moshiur_cse15 Cpp 0.40s
27 haasib Cpp 0.41s
28 anowar1112 Cpp 0.41s
29 INUA Cpp 0.41s
30 sahedsohel Cpp 0.41s
31 khatribiru Cpp 0.41s
32 Unpredictable Cpp 0.41s
33 Fahim_Ahmed Cpp 0.42s
34 subhashis_cse Cpp 0.42s
35 Roki_Moulik_12_EWU Cpp 0.43s
36 astrolion7 Cpp 0.43s
38 pinanzo Cpp 0.43s
39 Sarwar_sojol Cpp 0.43s
40 Koushik_12 Cpp 0.43s
41 h1j4l Cpp 0.43s
42 udashi Cpp 0.44s
43 shishir_hstu Cpp 0.44s
44 roxter Cpp 0.44s
45 MRITuhin Cpp 0.44s
46 ahqmrf Cpp 0.44s
47 ssavi Cpp 0.44s
48 fsshakkhor Cpp 0.44s
49 alamin39 Cpp 0.44s
50 _Lucifer Cpp 0.44s
Feedback