DCP-2: 6-N-Cryption Back to All Problems

Easy Math > Basic Math

In a software company a security team is working on an encryption system called 6-N-Cryption. Their task is to encrypt a data by using dynamic number of keys. Then encrypt those keys again by a secret key. Then they store them to a Database. You can assume that the original data is always an integer. **Encrypt Original Data:** The original data is encrypted by adding some keys with it. All the keys are prime numbers and none of the keys are used more than once. Also it is guaranteed that in every encryption they must use at least 2 keys. **Encrypt the key:** Every key is encrypted by multiplying it with a big prime number, p. This big prime number must be greater than all the keys. Then the encrypted data and keys are stored in the database. Now, you are sitting in their office for an interview and they give you this problem. You have to find the original data. **Sample Encrypt process with 2 keys:** Original data + Key_1 + Key_2 = Encrypted data (E). Then the team generates a big prime number ‘p’ that has to be greater than all keys to encrypt all of them. Key_1 * p = Encrypted_Key_1 Key_2 * p = Encrypted_Key_2 **Sample Decrypt process with 2 keys:** Determine the big prime number, **p**. Then divide those Encrypted_Keys to get the real keys. Key_1 = Encrypted_Key_1 / p; Key_2 = Encrypted_Key_2 / p; Original data = Encrypted data - Key_1 - Key_2; Input: ------ Each test case start with an encrypted number, **E**. Then the number of keys N(1<**N**<=10). Then there are N lines of input for the encrypted keys **EK**( 1< **EK** < 2^63) Two successive cases are separated by a single new line. Output: ------- For each test case, print “Output : O” (without quotation) where **O** denotes the original data. Sample Input ------------ 29 2 14 21 61 3 481 703 185 58 5 253 299 391 115 46 119 4 7199 939 13459 3443 Sample Output ------------- Output: 24 Output: 24 Output: 10 Output: 39 **Explanation of First Test Case:** Encrypted data is 29. In this case we have found **7** as big prime number. Then we divide those encrypted keys by this big prime number. 14 / 7 = 2 21 / 7 = 3 Original data = 29 - 2 - 3 = 24.

Problem Setter:

Md. Azizur Rahman Faiem

Please login to submit solution to this problem.

Problem Limits

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

Problem Stats




# User Language Timing
01 haasib Cpp 0.00s
02 Salty_Coder Cpp 0.00s
03 shahed_shd Cpp 0.00s
04 parthapratimbanik Cpp 0.00s
05 mahrahat Cpp 0.00s
06 momin12 Cpp 0.00s
07 ammasum Cpp 0.00s
08 ash12 Cpp 0.00s
09 sadia2427 Cpp 0.00s
10 shahid_ullah Cpp 0.00s
11 Knight_King Cpp 0.00s
12 ozone Cpp 0.00s
13 a_rahman Cpp 0.00s
14 Robiussani152 Cpp 0.00s
15 porag Cpp 0.00s
16 smriad Cpp 0.00s
17 Dark_Ocean Cpp 0.00s
18 emrul Cpp 0.01s
19 tonu Cpp 0.01s
20 nasibsu Cpp 0.01s
21 bengal_tiger Cpp 0.01s
22 sjsakib Cpp 0.01s
23 rajdipsaha Cpp 0.01s
24 ProMAGFAT Cpp 0.01s
25 adil_reza Cpp 0.01s
26 mhsjaber CSharp 0.04s
27 Partha11 Cpp 0.08s
28 jalal Cpp 0.22s
29 khayrul Cpp 0.23s
30 Amit_Khan Cpp 0.23s
31 moshiur_bd Cpp 0.25s
32 Dinar Cpp 0.33s
33 M3talicana Cpp 0.40s
34 tariqiitju Cpp 0.41s
35 njrafi Cpp 0.43s
36 subhashis_cse Cpp 0.44s
37 KNUTH Cpp 0.49s
38 rayhan50001 Cpp 0.49s
39 froghramar Cpp 0.49s
40 Red1 Cpp 0.49s
41 mhiceiuk Cpp 0.52s
42 mahbub07 Cpp 0.53s
43 murad_al_wajed Cpp 0.56s
44 duronto20 Cpp 0.58s
45 Siddartha Cpp 0.64s
46 Sabyasachi Cpp 0.78s
47 minhazur Java 1.73s

Your feedback is our precious!

Or call +88 02 9853138 for support