快读快输模板
likegarbage · · 算法·理论
#include<iostream>
using namespace std;
namespace Fast_IO{
FILE *fin=stdin,*fout=stdout;
const int BUF=1<<20;
char rbuf[BUF],*p1=rbuf,*p2=rbuf,wbuf[BUF],*p3=wbuf;
inline void flush_read(){p1=p2=rbuf;}
inline char _getchar(){return (p1==p2)&&(p2=(p1=rbuf)+fread(rbuf,1,BUF,fin),p1==p2)?EOF:*p1++;}
inline void flush_write(){fwrite(wbuf,1,p3-wbuf,fout),p3=wbuf;}
inline void _putchar(char ch){*p3++=ch;if(p3-wbuf==BUF)flush_write();}
template<typename T>
inline void read(T &x){
x=0;static char ch;T f=1;
do{ch=_getchar();if(ch=='-')f=-f;}while(!isdigit(ch));
do{x=(x<<1)+(x<<3)+(ch^48);ch=_getchar();}while(isdigit(ch));
x*=f;
}
inline void read(string &str){
static char ch;
str.clear();
do ch=_getchar();while(ch=='\n'||ch==' '||ch=='\r'||ch=='\t');
do str.push_back(ch),ch=_getchar();while(ch!='\n'&&ch!=' '&&ch!='\r'&&ch!='\t'&&ch!=EOF);
}
inline void read(char *chr){
static char ch;
do ch=_getchar();while(ch=='\n'||ch==' '||ch=='\r'||ch=='\t');
do *chr++=ch,ch=_getchar();while(ch!='\n'&&ch!=' '&&ch!='\r'&&ch!='\t'&&ch!=EOF);
*chr='\0';
}
template<typename T,typename... Args>
inline void read(T &x,Args &...args){read(x),read(args...);}
template<typename T>
inline void write(T x){
if(x<0)_putchar('-'),x=-x;
static char stack[1<<9],*tmp;
tmp=stack;
do*tmp++=(x%10)^48;while(x/=10);
while(tmp!=stack)_putchar(*--tmp);}
inline void write(const char ch){_putchar(ch);}
inline void write(const char *ch){while((*ch)!=0)_putchar(*ch++);}
inline void write(const string str){for(char ch:str)_putchar(ch);}
template<typename T,typename... Args>
inline void write(T x,Args... args){write(x),write(args...);}
class Flush{public:~Flush(){flush_write();}}tmp;
}using Fast_IO::read;using Fast_IO::write;
int main(){
}