ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1204. Idempotents

use extended euclidian algorithm
Posted by Diac Paul 29 Sep 2004 02:48
you have to find
x*p+y*q=1 (p,q - primes)
this is possible with extended GCD:
try this:
http://www.brainyencyclopedia.com/encyclopedia/e/ex/extended_euclidean_algorithm.html