首页 > 其他 > 详细

IO优化及一些define

时间:2019-11-13 00:14:20      阅读:80      评论:0      收藏:0      [点我收藏+]
//#pragma GCC optimize(2)
#include <bits/stdc++.h>
#define ll long long
#define ld long double
#define pb push_back
#define mp make_pair
#define X first
#define Y second
#define lb lower_bound
using namespace std;

namespace IO{
    inline char gc(){
        static char buf[100000],*p1=buf,*p2=buf;
        return p1==p2&&(p2=(p1=buf)+fread(buf,1,100000,stdin),p1==p2)?EOF:*p1++;
    }
    inline void read(int &x){
        x=0;bool y=0;char c=gc();while(c<'0'||c>'9'){if(c=='-') y=1;c=gc();}
        while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=gc();x=(y?-x:x);
    }
    inline void read(ll &x){
        x=0;bool y=0;char c=gc();while(c<'0'||c>'9'){if(c=='-') y=1;c=gc();}
        while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=gc();x=(y?-x:x);
    }
    inline void write(int x){if(!x) return;write(x/10);putchar(x%10+'0');}
    inline void write(ll x){if(!x) return;write(x/10);putchar(x%10+'0');}
    inline void print(int x){if(x<0) putchar('-'),write(-x);else if(x>0) write(x);else putchar('0');putchar('\n');}
    inline void print(ll x){if(x<0) putchar('-'),write(-x);else if(x>0) write(x);else putchar('0');putchar('\n');}
    inline void print2(int x){if(x<0) putchar('-'),write(-x);else if(x>0) write(x);else putchar('0');putchar(' ');}
    inline void print2(ll x){if(x<0) putchar('-'),write(-x);else if(x>0) write(x);else putchar('0');putchar(' ');}
}
using namespace IO;
/*
inline int random(int x){return 1ll*rand()*rand()%x+1;}
inline void fc(){
    for(int i=1;i<=500;i++){
        print(i);
        system("data.exe");
        system(".exe");
        system(".exe");
        if(system("fc xxx.out xxx.ans")) break;
    }
}
*/

///////////////////////jdkAKIOI///////////////////////////
//////////////////////////////////////////////////////////


int main(){
    //srand((unsigned)time(0));
    freopen("xxx.in","r",stdin);
    //freopen("xxx.out","w",stdout);

    return 0;
}

IO优化及一些define

原文:https://www.cnblogs.com/zxynothing/p/11846199.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!