输入优化

int read(){
    int x=0;
    char c;
    c=getchar();
    while(c<'0'||c>'9') c=getchar();
    while(c>='0'&&c<='9') {
        x=x*10+c-'0';
        c=getchar();
    }
    return x;
}



struct io
{
	char op[1 << 26] , * s;
	//数组大小即读入数据量大小
	io()
	{
		//一定注意在这里开文件
		//使用fread时无法从console中输入,请使用文件读入
		//freopen( "test.in" , "r" , stdin );
		//freopen( "test.out" , "w" , stdout );
		fread( s = op , 1 , 1 << 26 , stdin );
	}
	inline int read()
	{
		register int u = 0;
		while( * s < 48 ) s++;
		while( * s > 32 )
			u = u * 10 + * s++ - 48;
		return u;
	}
} ip;
#define read ip.read


posted @ 2018-02-03 14:10  lmjer  阅读(107)  评论(0编辑  收藏  举报