由于我有一次抢最优解的时候发现 getchar_unlocked 在linux环境可以编译但是在windos环境是不彳亍的,然后我发现了这篇文章 所以我有感而发把我原来的快读改成这样 (其实还有更唐的
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define _ read<int>()
template<class T>inline T read()
{
T f = 1 , x = 0;
char c=getchar();
while(!isdigit(c))
{
if(c == '-') f=-1;
c=getchar();
}
while(isdigit(c)) x=(x<<1)+(x<<3)+(c^48),c=getchar();
return f*x;
}
inline void out(int x)
{
if(x<0) putchar('-'),x=-x;
if(x<10) putchar(x+'0');
else out(x/10),putchar(x%10+'0');
}
signed main()
{
return 0;
}
改成了这样
#include<bits/stdc++.h>
using namespace std;
#ifdef __linux__
#define gc getchar_unlocked
#define pc putchar_unlocked
#else
#define gc _getchar_nolock
#define pc _putchar_nolock
#endif
#define int long long
#define R register
#define rint register int
#define _ read<int>()
inline bool blank(const char x)
{
return !(x^9)||!(x^13)||!(x^10)||!(x^32);
}
template<class T>inline T read()
{
T r=0,f=1;R char c=gc();
while(!isdigit(c))
{
if(c=='-') f=-1;
c=gc();
}
while(isdigit(c)) r=(r<<1)+(r<<3)+(c^48),c=gc();
return f*r;
}
inline void out(int x)
{
if(x<0) pc('-'),x=-x;
if(x<10) pc(x+'0');
else out(x/10),pc(x%10+'0');
}
inline void read(char &x)
{
for(x=gc();blank(x)&&(x^-1);x=gc());
}
signed main()
{
return 0;
}不过到这里其实还没啥问题。但是我有一天交题的时候突然CE了,我就认为是luogu_getchar_nolock编译不了了(我还发了个讨论)(因为它CE报的是这),到今天我发现我把__linux__打成了__liunx__我直接炸了最唐的是我最开始熟悉这个快读多打了几遍我还在想要注意是__linux__不是__liunx__。