4 Star 25 Fork 17

编程语言算法集 / Go

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
extendedgcd.go 270 Bytes
一键复制 编辑 原始数据 按行查看 历史
Ryusei Nagai 提交于 2021-09-03 18:08 . Add extended gcd (#307)
package gcd
// ExtendedRecursive finds and returns gcd(a, b), x, y satisfying a*x + b*y = gcd(a, b).
func ExtendedRecursive(a, b int64) (int64, int64, int64) {
if b > 0 {
d, y, x := ExtendedRecursive(b, a%b)
y -= (a / b) * x
return d, x, y
}
return a, 1, 0
}
Go
1
https://gitee.com/TheAlgorithms/Go.git
git@gitee.com:TheAlgorithms/Go.git
TheAlgorithms
Go
Go
master

搜索帮助