美文网首页
Extended Euclidean Algorithm

Extended Euclidean Algorithm

作者: fo0Old | 来源:发表于2017-03-03 19:47 被阅读0次
    namespace math
    {
        struct eg{ll x,y,r;eg(ll x,ll y,ll r):x(x),y(y),r(r){}};
        eg exgcd(ll a,ll b)
        {
            if(!b)return eg(1,0,a);
            eg t=exgcd(b,a%b);
            return eg(t.y,t.x-a/b*t.y,t.r);
        }
    }
    using math::eg;
    using math::exgcd;
    

    相关文章

      网友评论

          本文标题:Extended Euclidean Algorithm

          本文链接:https://www.haomeiwen.com/subject/gsbrgttx.html