luckYrat's library.

This documentation is automatically generated by competitive-verifier/competitive-verifier


:heavy_check_mark: cpp/math/expansion-gcd.cpp

Required by

Verified with

Code

template <typename T>
pair<T,T> extgcd(T a,T b){
  if(b!=0){
    auto A = extgcd(b,a%b);
    T tmp = A.second;
    A.second = A.first-(a/b)*A.second;
    A.first = tmp;
    return A;
  }else{
    return {1,0};
  }
}

#line 1 "cpp/math/expansion-gcd.cpp"
template <typename T>
pair<T,T> extgcd(T a,T b){
  if(b!=0){
    auto A = extgcd(b,a%b);
    T tmp = A.second;
    A.second = A.first-(a/b)*A.second;
    A.first = tmp;
    return A;
  }else{
    return {1,0};
  }
}

Back to top page