方便人类——信息学训练专用库

/* Author:597 Description: This is a Header File for coding. It has many function which can make us coding easily or running quickly. */
#include 
#include 
#include 
#include 
#include 
using namespace std;
//File IO
#define I_O(x) freopen(""#x".in","r",stdin);freopen(""#x".out","w",stdout)
//for Pascal党&码速 
#define forp(i,a,b) for(i=a;i<=b;i++)
#define form(i,a,b) for(i=a;i>=b;i--)
#define until(x) while (!(x))
//for "memset"
#define INF 2139062143
#define NINF -2139062144
//for 读入优化 
#define IN(x,a,b) (a<=x && x<=b)
template <typename T>
    inline void input(T& x)//专为读整数设计 
    {
        char ch=getchar();
        while (!(IN(ch,'0','9')||ch=='-'))
            ch=getchar();
        if (ch!='-')
        {
            x=0;
            do
            {
                x=x*10+ch-48;
                ch=getchar();
            }
            while (IN(ch,'0','9'));
        }
        else
        {
            ch=getchar();
            x=0;
            do
            {
                x=x*10+ch-48;
                ch=getchar();
            }
            while (IN(ch,'0','9'));
            x=-x;
        }
    }
inline int get_int()//专为读int设计
{
    char ch=getchar();
    int x=0;
    while (!(IN(ch,'0','9')||ch=='-'))
        ch=getchar();
    if (ch!='-')
    {
        do
        {
            x=x*10+ch-48;
            ch=getchar();
        }
        while (IN(ch,'0','9'));
    }
    else
    {
        ch=getchar();
        do
        {
            x=x*10+ch-48;
            ch=getchar();
        }
        while (IN(ch,'0','9'));
        x=-x;
    }
    return x;
}
//for math
template <typename T>
    inline T sqr(T x){return x*x;}
template <typename T>
    inline T pow(T x,T y)
    {
        T tmp=x,ret=1;
        while (y)
        {
            if (y&1)
                ret*=tmp;
            y>>=1;
            tmp*=tmp;   
        }
        return ret;
    }
//for random(including  and )
#define randomize srand(time(0))
#define random(l,r) (l+rand()%(r-l+1))
//for string
#include 
using namespace std;
inline void input(string& s)//读字符串 
{
    char ch=getchar();
    while (!IN(ch,33,126))
        ch=getchar();
    s="";
    do
    {
        s+=ch;
        ch=getchar();
    }
    while (IN(ch,33,126));
}
inline void input_line(string& s)
{
    char ch=getchar();
    while (!IN(ch,32,126))
        ch=getchar();
    s="";
    do
    {
        s+=ch;
        ch=getchar();
    }
    while (IN(ch,32,126));
}
inline void output(string& s)//写字符串(没帮你换行,若是要换行打上putchar('\n');) 
{
    int i;
    for (i=0;s[i]!='\0';i++)
        putchar(s[i]);
}

你可能感兴趣的:(方便人类——信息学训练专用库)