各种输入输出挂了解一下,它的强大让我感到可怕:https://www.cnblogs.com/Empress/p/3997210.html:
原理:https://blog.csdn.net/f_zyj/article/details/51473493
感觉普通外挂已经足以:
/* 仅适合纯数字输入输出,该版本负数输入时有点问题,请采用上方网络链接中的版本 */
#include <cstdio>
int Scan() { //输入外挂
int res = 0, flag = 0;
char ch;
if((ch = getchar()) == '-') flag = 1;
else if(ch >= '0' && ch <= '9') res = ch - '0';
while((ch = getchar()) >= '0' && ch <= '9')
res = res * 10 + (ch - '0');
return flag ? -res : res;
}
void Out(int a) { //输出外挂
if(a < 0) { putchar('-'); a = -a; }
if(a >= 10) Out(a / 10);
putchar(a % 10 + '0');
}
int main() {
int T, n;
scanf("%d", &T);
while(T--) {
n = Scan();
Out(n);
printf("\n");
}
return 0;
}
队友的输入外挂:
template <class T>
inline bool scan_d(T &ret)
{
char c; int sgn;
if (c = getchar(), c == EOF) return 0; //EOF
while (c != '-' && (c < '0' || c > '9')) c = getchar();
sgn = (c == '-') ? -1 : 1;
ret = (c == '-') ? 0 : (c - '0');
while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
ret *= sgn;
return 1;
}
inline void out(ll x)
{
if (x > 9) out(x / 10);
putchar(x % 10 + '0');
}
风火轮加速版(普通外挂TLE,该挂400+ms,HDU6396,限时1000ms):
const int MAXBUF=10000;
char buf[MAXBUF],*ps=buf,*pe=buf+1;
inline void rnext()
{
if(++ps==pe)
pe=(ps=buf)+fread(buf,sizeof(char),sizeof(buf)/sizeof(char),stdin);
}
template<class T>
inline bool in(T &ans)
{
ans=0;
T f=1;
if(ps==pe) return false;
do{
rnext();
if('-'==*ps) f=-1;
}while(!isdigit(*ps)&&ps!=pe);
if(ps==pe) return false;
do
{
ans=(ans<<1)+(ans<<3)+*ps-48;
rnext();
}while(isdigit(*ps)&&ps!=pe);
ans*=f;
return true;
}