#include #include "numalgo.h" using namespace std; Bigint gcd(Bigint a,Bigint b){ while(true){ if(a==0)return b; if(b==0)return a; if(a>=b)a=a.divmod(b).second; else b=b.divmod(a).second; } } Bigint egcd(const Bigint &a,const Bigint &b,Bigint &x,Bigint &y){ Bigint x2(0),y2(1),r(a),r2(b); x=1; y=0; //cerr<