// 扩展欧几里得做法;
1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<cstring> 5 #define ll long long 6 using namespace std; 7 8 ll ex_gcd(ll a,ll b,ll &x,ll &y)//扩展欧几里得(扩展gcd) 9 { 10 if (a==0&&b==0) return -1; 11 if (b==0){x=1;y=0;return a;} 12 ll d=ex_gcd(b,a%b,y,x); 13 y-=a/b*x; 14 return d; 15 } 16 17 ll mod_inverse(ll a,ll mod)//乘法逆元 18 { 19 ll x,y; 20 ll d = ex_gcd(a,mod,x,y); 21 return (x%mod+mod)%mod; 22 } 23 int low_bit(int x){return x&(-x);} 24 int main() 25 { 26 for(int i=0;i<=16;i++) 27 cout<<i<<' '<<low_bit(i)<<endl; 28 return 0; 29 }