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 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

142/624

Solve/Submission

Ranking

# User Language Timing
01 ozone Cpp14 0.00s
02 ash12 Cpp14 0.00s
03 MAHRahat Cpp14 0.00s
04 Dark_Ocean Cpp14 0.00s
05 pusku Cpp 0.00s
06 haasib Cpp14 0.00s
07 Knight_King Cpp14 0.00s
08 Shammo Cpp14 0.00s
09 _zErO_ Cpp14 0.00s
10 afzalul Cpp14 0.00s
11 a_rahman Cpp14 0.00s
12 shahed_shd Cpp14 0.00s
13 anik_JU Cpp14 0.00s
14 Rakib05 Cpp 0.00s
15 Salty_Coder Cpp14 0.00s
16 parthapratimbanik Cpp14 0.00s
17 ammasum Cpp14 0.00s
18 SakibAlamin Cpp14 0.00s
19 sadia2427 Cpp14 0.00s
20 shahid_ullah Cpp14 0.00s
21 Robiussani152 Cpp14 0.00s
22 smriad Cpp14 0.00s
23 sb_rithu Cpp14 0.00s
24 porag Cpp14 0.00s
25 opu1604073 C 0.00s
26 rithu Cpp14 0.00s
27 rakib_cou Cpp 0.00s
28 Ehsanul_Fahad Cpp 0.00s
29 Morass Cpp14 0.00s
30 RRizkiR Cpp 0.00s
31 sazzad33r C 0.00s
32 tarikul_4152 C 0.00s
33 shameemreza Cpp 0.00s
34 1504038_arafath C 0.00s
35 Ryuuk Cpp 0.00s
36 prateepm Cpp14 0.00s
37 armanferdous Cpp 0.00s
38 Azaxdev Cpp 0.00s
39 Robbinb1993 Cpp 0.00s
40 Virus_123 Cpp 0.00s
41 Ornob011 Cpp 0.00s
42 abdullahaahnaf1 Cpp 0.00s
43 SRTarek Cpp 0.00s
44 rabbicse C 0.00s
45 Neon10 Cpp14 0.01s
46 iierrrorii Cpp14 0.01s
47 rashad1987 Cpp 0.01s
48 araf_15 Cpp 0.01s
49 ahoteshanul C 0.01s
50 Riaz_BSMRSTU Cpp 0.01s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support