rt,写某道神仙毒瘤题的时候被卡了输入途径,于是我果断选择快读
本来的快读是这样的:
#define re register
inline __int128 read(){
int x = 0,f = 1;
re char c = getchar_unlocked();
while(c < '0' || c > '9'){
if(c == '-'){
f = -1;
}
c = getchar_unlocked();
}
while(c >= '0' && c <= '9'){
x = x * 10 + c - '0';
c = getchar_unlocked();
}
return x * f;
}
可以发现,这个快读是考虑了负数的。但题目数据中不存在负数,我就去掉了考虑负数的代码,改成了这样:
#define re register
inline unsigned __int128 read(){
int x = 0;
re char c = getchar_unlocked();
while(c >= '0' && c <= '9'){
x = x * 10 + c - '0';
c = getchar_unlocked();
}
return x;
}
但一交,发现WA完了
后来偶然发现,如果保留针对负数的代码,但不让其结果对答案产生贡献,居然也能过:
#define re register
inline unsigned __int128 read(){
int x = 0,f = 1;
re char c = getchar_unlocked();
while(c < '0' || c > '9'){
if(c == '-'){
f = -1;
}
c = getchar_unlocked();
}
while(c >= '0' && c <= '9'){
x = x * 10 + c - '0';
c = getchar_unlocked();
}
return x;
}
本人已懵,求助