快读快写模版

read(), write() \(<\) scanf(), printf() \(\approx\) ios::sync_with_stdio(0)+cin,cout \(<\) cin,cout
可见快读快写还是很厉害的
再加上 __int128 可以使用, 手写读入输出就很重要了

#include <bits/stdc++.h>
#define re register
#define lll __int128    // NOIp 开放部分带下划线的东西啦
using namespace std;

// 快读
lll read(){
    lll sign=1,num=0;
    char ch=getchar();
    while(ch<'0' || ch>'9'){
        if(ch=='-') sign=-1;
        ch=getchar();
    }
    while(ch>='0' && ch<='9'){
        num=num*10+ch-'0';
        ch=getchar();
    }
    return num*sign;
}

// 快写
void write(lll x){
    if(x<0){
        putchar('-');
        x=~x+1; // 相当于 x=-x
    }
    if(x>9) write(x/10);
    putchar(x%10+'0');
}

int main()
{
    ios::sync_with_stdio(0);
    clock_t c1 = clock();
#ifdef LOCAL
    freopen("data.in","r",stdin);
    freopen("data.out","w",stdout);
#endif
    // ======================================================================
    lll x=read();
    write(x);

    // ======================================================================
end:
    cerr << "Time Used:" << clock() - c1 << "ms" << endl;
    return 0;
}
posted @ 2021-09-03 21:39  不爱喝橙子汁的橙子  阅读(121)  评论(0编辑  收藏  举报