问:luogu在线IDE不支持快读???
  • 板块灌水区
  • 楼主ker_xyxyxyx_xxs
  • 当前回复5
  • 已保存回复5
  • 发布时间2021/7/18 20:57
  • 上次更新2023/11/4 14:14:58
查看原帖
问:luogu在线IDE不支持快读???
335477
ker_xyxyxyx_xxs楼主2021/7/18 20:57

RT 快读如下:

static char buf[1000000],*p1=buf,*p2=buf,obuf[1000000],*p3=obuf;
#define getchar() p1==p2&&(p2=(p1=buf)+fread(buf,1,1000000,stdin),p1==p2)?EOF:*p1++
#define putchar(x) (p3-obuf<1000000)?(*p3++=x):(fwrite(obuf,p3-obuf,1,stdout),p3=obuf,*p3++=x)
template<typename item>
inline void read(register item &x)
{
    x=0;register char c=getchar();
    while(c<'0'||c>'9')c=getchar();
    while(c>='0'&&c<='9')x=(x<<3)+(x<<1)+(c^48),c=getchar();
}
static char cc[10000];
template<typename item>
inline void print(register item x)
{ 
	register long long len=0;
	while(x)cc[len++]=x%10+'0',x/=10;
	while(len--)putchar(cc[len]);
}

fwrite(obuf,p3-obuf,1,stdout);

其中

print(Cnt);puts("");

直接爆掉了,究竟怎么才能输出正确答案?

2021/7/18 20:57
加载中...