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
IviewwithSelf
Handling new types without using RTTI
Minimum number of jumps DP
gp series
Dictionary
SpiralMatrix
thermal_containers
AVL - ith element
C++ Inheritance Example
Area of a triangle using templete