C++奇淫テクニック(緩更)

1544 ワード

C++奇淫テクニック
scanf("%[^
]", s); lower_bound
   
/*
    |      |
    |16/11/05ztx, thanks to chaixiaojun|
*/

int father[maxn];   //    i father     

void makeSet() {  
    for (int i = 0; i < maxn; i++)   
        father[i] = i;  
}  

int findRoot(int x) {   //        
    int root = x; //      
    while (root != father[root]) { //        
        root = father[root];  
    }  
    while (x != root) {  
        int tmp = father[x];  
        father[x] = root; //        
        x = tmp;  
    }  
    return root;  
}  

void Union(int x, int y) {  //   x      y               。  
    int a, b;  
    a = findRoot(x);  
    b = findRoot(y);  
    father[a] = b;  // y  x         father[b] = a x  y     ;  
}  

/*
     findRoot(x) :
               
                           
*/

#include
#include
#include
#include
#include
#define each(a,b,c) for(int a=b;a<=c;a++)
#define de(x) cout<

高速べき乗
typedef long long ll;
//     ,res  a,a  ,n  
ll powermod(ll a, ll n, ll mod)
{
    ll res = 1;
    while (n > 0)
    {
        if (n & 1)
        {
            res = (res*a) % mod;
        }
        a = (a*a) % mod;
        n >>= 1;
    }
    return res;
}
CSP            DP,        
int gcd(int a, int b)
{
    return b == 0 ? a : gcd(b, a%b);
}
       ,