Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Extended Euclidean Algorithm
//g++ 5.4.0 #include <bits/stdc++.h> using namespace std; int extendedEuclid(int a, int b, int& x, int& y){ if(b==0){ y=0; x=1; return a; } else{ int x1,y1; int gcd = extendedEuclid(b, a%b,x1,y1); x = y1; y = x1 - y1*(a/b); return gcd; } } int main() { int a=5,b=3,c,x,y; int gcd = extendedEuclid(a,b,x,y); cout<<gcd<<" "<<x<<" "<<y<<endl; }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
BinSearch
Nth max element in BST
Dar
Operation on Set Container
c2p_update
q
Tray
StackQuiz
4149 coj WIP
Triangle
Please log in to post a comment.