sangshang @ 2023-12-19 12:49:00
本体最后一个测试点输入奇特,没有换行符之类的截至读入最后一个数字。平时没问题的快读会
不妨做出如下改动。
namespace IO {
const int IN_LEN = 1 << 21;
char buf[IN_LEN], *front = buf, *back = buf;
inline char FastGetchar() {
if (front >= back) {
front = buf;
back = buf + fread(buf, 1, IN_LEN, stdin);
}
return *(front++);
}
inline int read() {
int ret = 0;
char ch = FastGetchar();
bool flag = false;
while (ch < '0' || ch > '9') {
if (ch == '-') {
flag = true;
}
ch = FastGetchar();
}
while (ch >= '0' && ch <= '9') {
ret = ret * 10 + ch - '0';
ch = FastGetchar();
}
return flag ? -ret : ret;
}
}
namespace IO {
const int IN_LEN = 1 << 21;
char buf[IN_LEN], *front = buf, *back = buf;
bool IO_END=false;
inline char FastGetchar() {
if (front >= back) {
front = buf;
back = buf + fread(buf, 1, IN_LEN, stdin);
if(front==back){
IO_END=true;
return '0';
}
}
return *(front++);
}
inline int read() {
int ret = 0;
char ch = FastGetchar();
/*if(IO_END){
return ret;
}*/
bool flag = false;
while (ch < '0' || ch > '9') {
if (ch == '-') {
flag = true;
}
ch = FastGetchar();
/*if(IO_END){
return ret;
}*/
}
while (ch >= '0' && ch <= '9') {
ret = (unsigned int)ret * 10 + ch - '0';
ch = FastGetchar();
if(IO_END){
return ret;
}
}
return flag ? -ret : ret;
}
}