您的位置:首页 > 其它

最强外挂输入输出模板

2018-03-08 15:58 337 查看
/*
    2017年多校第一场最后一题需要外挂输入输出进化版来处理数据,否则将会不停的TLE,从没想到是在外挂输入输出模板上面卡住了
    从那场后长姿势了,马上更换成了这个模板,该代码是从标程中提取出来的,比一般的都强大,从此以后再没有在这上面被卡过。
    需要freopen文件输入输出来测试样例答案,否则用命令行输入不会返回结果,交题时记得注释掉freopen喔~
*/
#include <cstdio>
#include <cstring>
#include <algorithm>
typedef long long LL;
namespace fastIO {
#define BUF_SIZE 100000
//fread -> read
bool IOerror = 0;
inline char nc() {
static char buf[BUF_SIZE], *p1 = buf + BUF_SIZE, *pend = buf + BUF_SIZE;
if(p1 == pend) {
p1 = buf;
pend = buf + fread(buf, 1, BUF_SIZE, stdin);
if(pend == p1) {
IOerror = 1;
return -1;
}
}
return *p1++;
}
inline bool blank(char ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline void read(int &x) {
char ch;
while(blank(ch = nc()));
if(IOerror)
return;
for(x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0');
}
#undef BUF_SIZE
};
using namespace fastIO;
const int maxn = 1000001, mod = 1000000007;
int n, num[maxn];
int main()
{
for(int Case = 1; read(n), !fastIO::IOerror; ++Case)
{
for(int i = 1; i <= n; ++i)
read(num[i]);
}
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: