2021-09-03 21:39阅读: 132评论: 0推荐: 0

快读快写模版

read(), write() < scanf(), printf() 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;
}

本文作者:咕噜咕噜酱

本文链接:https://www.cnblogs.com/syqwq/p/15225030.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   不爱喝橙子汁的橙子  阅读(132)  评论(0编辑  收藏  举报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
收起