eolymp
bolt
Попробуйте наш новый интерфейс для отправки задач
Задачи

RSA факторизация

RSA факторизация

The positive integer \textbf{n} is given. It is known that \textbf{n = p * q}, where \textbf{p} and \textbf{q} are primes, \textbf{p} <= \textbf{q} and |\textbf{q-kp}|<=\textbf{10^5} for some given positive integer \textbf{k}. You must find \textbf{p} and \textbf{q}. \InputFile Each line contains integers \textbf{n} (\textbf{1} < \textbf{n} < \textbf{10^120}) and \textbf{k} (\textbf{0} < \textbf{k} < \textbf{10^8}). \OutputFile For each pair of numbers \textbf{n} and \textbf{k} print in separate line the product \textbf{p * q} such that \textbf{p} <= \textbf{q} .
Лимит времени 2 секунды
Лимит использования памяти 64 MiB
Входные данные #1
35 1
121 1
1000730021 9
Выходные данные #1
5 * 7
11 * 11
10007 * 100003
Источник 2009 South Eastern European Regional Programming Contest, October 17, Problem A