快读“慢”写模板

//万能头文件
#include<bits/stdc++.h>
using namespace std;
template<typename T>
inline T read(T &ret){
    char c;
    int f=1;
    ret=0;			//Don't forget this!
    for(c=getchar();c<'0'||c>'9';c=getchar())if(c=='-')f=-f;
    for(;c>='0'&&c<='9';c=getchar())ret=ret*10+c-'0';
    return ret*=f;	//返回值可不使用,参数必须传递。参数与返回的形参一致。
}
template<typename T>
inline void write(T x){
     if(x<0)putchar('-'),x=-x;
     if(x>9)write(x/10);
     putchar(x%10+'0');
}				//慢写,由于速度并不快,所以不建议使用,仅仅针对__int128类型

P.S. 已更新至最新版

请使用最新版,老版快读bug有亿点点多(咕咕咕,被逼急才更新)。

Hencecho 2021-12-28 15:22:00
问题是这快写甚至比不过printf(

Hencecho 2021-12-28 15:22:25
试试跑下20M左右的输出就知道了...

Hencecho 2021-12-28 15:23:39
初二时候就是因为这个卡了一天常。 还自认为很快

感谢@Hencecho!

posted @ 2023-09-30 12:28  _wbf  阅读(13)  评论(1)    收藏  举报