快读
如果关了同步流
cstdio 里边那一套东西是不可以和 iostream 里边那一套东西混用的
具体来讲,scanf getchar 和 cin 不能混用,而 printf puts 不能和 cout 混用
关流之后 cout 手动刷新缓冲区的方法是 cout << flush;
快读
inline int read()
{
int x=0,f=1;
char ch=getchar();
while(ch<'0'||ch>'9')
{
if(ch=='-')
f=-1;
ch=getchar();
}
while(ch>='0' && ch<='9')
x=x*10+ch-'0',ch=getchar();
return x*f;
}
快写
void write(int x)
{
if(x<0)
putchar('-'),x=-x;
if(x>9)
write(x/10);
putchar(x%10+'0');
return;
}O2优化
#pragma GCC optimize(2)Last updated