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
typeid
ISPrime
TREAP RANGE QUERY (but it's runtime is not that good)
Using C's sprinf() Function to Format Output String
Type erasure
ONP
2018JanSilv2
30 აპრილი
Stream11
A • Potato Sacks