|
楼主 |
发表于 2008-7-18 23:54:00
|
显示全部楼层
RSA Attack
RSA Attack
Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB
Total submit users: 5, Accepted users: 2
Problem 10161 : No special judgement
Problem description
Thre RSA problem is the following: given a positive integer n that is a product of two distinct odd primes p and q, a positive integer e such that gcd(e, (p-1)*(q-1)) = 1, and an integer c, find an integer m such that me = c (mod n) .
Input
One number K (K ≤ 2000) in the first line is an amount of tests. Each next line represents separate test, which contains three positive integer numbers ?C e, n and c (e, n, c ≤ 32000, n = p * q, which p, q are distinct odd primes, gcd(e, (p-1)*(q-1)) = 1, e < (p - 1) * (q - 1) ).
Output
For each input test the program must find the encrypted integer m.
Sample Input
3
9 187 129
11 221 56
7 391 204
Sample Output
7
23
17
Problem Source
Michael Medvedev |
|