P2824
快读快写模板(无负数):
#include <bits/stdc++.h>
static char buf[1000000],*p1=buf,*p2=buf;
static char buf2[1000000],*pp=buf2;
#define getchar() p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++
inline void pc(char ch) {
if(pp-buf2==1000000) fwrite(buf2,1,1000000,stdout),pp=buf2;
*pp++=ch;
}
inline void pcc() {
fwrite(buf2,1,pp-buf2,stdout);
pp=buf2;
}
inline int read() {
register int x(0);register char c(getchar());
while(c<'0'||c>'9') c=getchar();
while(c>='0'&&c<='9') x=(x<<1)+(x<<3)+(c^48),c=getchar();
return x;
}
void write(int x) {
static int stk[20];
int top=0;
do {
stk[top++]=x%10,x/=10;
}while(x);
while(top) pc(stk[--top]+'0');
}
void we(int x) {
write(x);
pc('\n');
}
signed main() {
pcc();
return 0;
}字符串快读:
inline std::string read2() {
std::string x;register char c(getchar());
while(c<'A'||c>'Z') c=getchar();
while(c>='A'&&c<='Z') x+=c,c=getchar();
return x;
}