Run Code
|
API
|
Code Wall
|
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
Bimap operations
NonparaRuns
multiply two numbers (previous)
How to make stupid to my friend?
12535
Kth smallest element
Test 4(2020)
pure virtual function with non-fixed number of parameters
Vector Example
BinTree