Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int odwr(int x, int y) {
- PII p1 = {0, y};
- PII p2 = {1, x};
- while (p2.ND != 1) {
- int ile = p1.ND/p2.ND;
- PII p3;
- p3.ST = ((p1.ST-p2.ST*ile)%y+y)%y;
- p3.ND = ((p1.ND-p2.ND*ile)%y+y)%y;
- p1 = p2;
- p2 = p3;
- }
- return p2.ST;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement