简单备忘

因为博主是蒟蒻,学了的东西一下就忘了QAQ......在这里随便记录一下

int快读模板

inline int read(){
    int x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

ll快读模板

inline ll read(){
    ll x=0,f=1;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        if(ch=='-')
            f=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        x=(x<<1)+(x<<3)+(ch^48);
        ch=getchar();
    }
    return x*f;
}

int快写模板

inline void write(int x)
{
    if(x<0){
     putchar('-');
x=-x;
}
    if(x>9) 
write(x/10);
    putchar(x%10+'0');
}

输入输出加速

std::ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);

c/c++中int,long,long long的取值范围:

unsigned   int   0~4294967295   
int   -2147483648~2147483647 
unsigned long 0~4294967295
long   -2147483648~2147483647
long long的最大值:9223372036854775807
long long的最小值:-9223372036854775808
unsigned long long的最大值:18446744073709551615  //20位

__int64的最大值:9223372036854775807
__int64的最小值:-9223372036854775808
unsigned __int64的最大值:18446744073709551615

本地读文件调试

//#pragma GCC optimize(2)
 
//#define LOCAL
 
//加在main函数最前面
//************************提交记得注释LOCAL******************************
#ifdef LOCAL
    freopen("in.txt", " r", stdin);
    freopen("out.txt", " w", stdout);
#endif
原文地址:https://www.cnblogs.com/akaku/p/13412769.html