快如闪电,清华杜瑜皓的读入挂,一模一样代码,加了这个之后。。。

细思极恐,and 整整行!!!

namespace IO{
#define BUF_SIZE 100000
#define OUT_SIZE 100000
#define ll long long
//fread->read bool IOerror=;
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,,BUF_SIZE,stdin);
if (pend==p1){IOerror=;return -;}
//{printf("IO error!\n");system("pause");for (;;);exit(0);}
}
return *p1++;
}
inline bool blank(char ch){return ch==' '||ch=='\n'||ch=='\r'||ch=='\t';}
inline void read(int &x){
bool sign=; char ch=nc(); x=;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch=='-')sign=,ch=nc();
for (;ch>=''&&ch<='';ch=nc())x=x*+ch-'';
if (sign)x=-x;
}
inline void read(ll &x){
bool sign=; char ch=nc(); x=;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch=='-')sign=,ch=nc();
for (;ch>=''&&ch<='';ch=nc())x=x*+ch-'';
if (sign)x=-x;
}
inline void read(double &x){
bool sign=; char ch=nc(); x=;
for (;blank(ch);ch=nc());
if (IOerror)return;
if (ch=='-')sign=,ch=nc();
for (;ch>=''&&ch<='';ch=nc())x=x*+ch-'';
if (ch=='.'){
double tmp=; ch=nc();
for (;ch>=''&&ch<='';ch=nc())tmp/=10.0,x+=tmp*(ch-'');
}
if (sign)x=-x;
}
inline void read(char *s){
char ch=nc();
for (;blank(ch);ch=nc());
if (IOerror)return;
for (;!blank(ch)&&!IOerror;ch=nc())*s++=ch;
*s=;
}
inline void read(char &c){
for (c=nc();blank(c);c=nc());
if (IOerror){c=-;return;}
}
//fwrite->write
struct Ostream_fwrite{
char *buf,*p1,*pend;
Ostream_fwrite(){buf=new char[BUF_SIZE];p1=buf;pend=buf+BUF_SIZE;}
void out(char ch){
if (p1==pend){
fwrite(buf,,BUF_SIZE,stdout);p1=buf;
}
*p1++=ch;
}
void print(int x){
static char s[],*s1;s1=s;
if (!x)*s1++='';if (x<)out('-'),x=-x;
while(x)*s1++=x%+'',x/=;
while(s1--!=s)out(*s1);
}
void println(int x){
static char s[],*s1;s1=s;
if (!x)*s1++='';if (x<)out('-'),x=-x;
while(x)*s1++=x%+'',x/=;
while(s1--!=s)out(*s1); out('\n');
}
void print(ll x){
static char s[],*s1;s1=s;
if (!x)*s1++='';if (x<)out('-'),x=-x;
while(x)*s1++=x%+'',x/=;
while(s1--!=s)out(*s1);
}
void println(ll x){
static char s[],*s1;s1=s;
if (!x)*s1++='';if (x<)out('-'),x=-x;
while(x)*s1++=x%+'',x/=;
while(s1--!=s)out(*s1); out('\n');
}
void print(double x,int y){
static ll mul[]={,,,,,,,,,
,10000000000LL,100000000000LL,1000000000000LL,10000000000000LL,
100000000000000LL,1000000000000000LL,10000000000000000LL,100000000000000000LL};
if (x<-1e-)out('-'),x=-x;x*=mul[y];
ll x1=(ll)floor(x); if (x-floor(x)>=0.5)++x1;
ll x2=x1/mul[y],x3=x1-x2*mul[y]; print(x2);
if (y>){out('.'); for (size_t i=;i<y&&x3*mul[i]<mul[y];out(''),++i); print(x3);}
}
void println(double x,int y){print(x,y);out('\n');}
void print(char *s){while (*s)out(*s++);}
void println(char *s){while (*s)out(*s++);out('\n');}
void flush(){if (p1!=buf){fwrite(buf,,p1-buf,stdout);p1=buf;}}
~Ostream_fwrite(){flush();}
}Ostream;
inline void print(int x){Ostream.print(x);}
inline void println(int x){Ostream.println(x);}
inline void print(char x){Ostream.out(x);}
inline void println(char x){Ostream.out(x);Ostream.out('\n');}
inline void print(ll x){Ostream.print(x);}
inline void println(ll x){Ostream.println(x);}
inline void print(double x,int y){Ostream.print(x,y);}
inline void println(double x,int y){Ostream.println(x,y);}
inline void print(char *s){Ostream.print(s);}
inline void println(char *s){Ostream.println(s);}
inline void println(){Ostream.out('\n');}
inline void flush(){Ostream.flush();}
#undef ll
#undef OUT_SIZE
#undef BUF_SIZE
};

无法从黑框输入数据,只能从文档测了,所以有必要。。。

用法举例:

freopen("YuEr.in","r",stdin);
freopen("YuEr","w",stdout);
IO::read(t);
IO::print(i),IO::print(' ');IO::println(n);

读入挂(IO)的更多相关文章

  1. JAVA读入挂

    队友扒的uwi的读入挂,非常强,再也不用担心java比C++慢了-- import java.util.*; import java.math.*; import java.io.ByteArrayI ...

  2. 牛客网 牛客练习赛43 C.Tachibana Kanade Loves Review-最小生成树(并查集+Kruskal)+建虚点+读入挂

    链接:https://ac.nowcoder.com/acm/contest/548/C来源:牛客网 Tachibana Kanade Loves Review 时间限制:C/C++ 2秒,其他语言4 ...

  3. HDU 6396 Swordsman --------2018 Multi-University Training Contest 7 (模拟+读入挂)

    原题地址: 打怪升级 一开始有N个怪物:主角有K个能力:只有K个能力都击败怪物才能斩杀怪物并获得K个能力的增值:问最多能杀几个怪物: 做法: 用优先队列把怪物能力装进去:能力小放前面: 最重要的是数据 ...

  4. HDU 6044 Limited Permutation 读入挂+组合数学

    Limited Permutation Problem Description As to a permutation p1,p2,⋯,pn from 1 to n, it is uncomplica ...

  5. HDU 6396 贪心+优先队列+读入挂

    Swordsman Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total ...

  6. 洛谷 P4149 [IOI2011]Race-树分治(点分治,不容斥版)+读入挂-树上求一条路径,权值和等于 K,且边的数量最小

    P4149 [IOI2011]Race 题目描述 给一棵树,每条边有权.求一条简单路径,权值和等于 KK,且边的数量最小. 输入格式 第一行包含两个整数 n, Kn,K. 接下来 n - 1n−1 行 ...

  7. 洛谷 P2634 [国家集训队]聪聪可可-树分治(点分治,容斥版) +读入挂+手动O2优化吸点氧才过。。。-树上路径为3的倍数的路径数量

    P2634 [国家集训队]聪聪可可 题目描述 聪聪和可可是兄弟俩,他们俩经常为了一些琐事打起来,例如家中只剩下最后一根冰棍而两人都想吃.两个人都想玩儿电脑(可是他们家只有一台电脑)……遇到这种问题,一 ...

  8. fread读入挂and普通读入挂and浮点数读入挂

    fread读入挂 版本一 namespace fastIO { #define BUF_SIZE 100000 //fread -> read bool IOerror = 0; inline ...

  9. 牛客网 牛客练习赛43 F.Tachibana Kanade Loves Game-容斥(二进制枚举)+读入挂

    链接:https://ac.nowcoder.com/acm/contest/548/F来源:牛客网 Tachibana Kanade Loves Game 时间限制:C/C++ 1秒,其他语言2秒 ...

随机推荐

  1. EasyARM-iMX283A的make menuconfig出现错误:Install ncurses(ncurses-devel) and try again。

    lin@lin-machine:~/linux-2.6.35.3$ make menuconfig *** Unable to find the ncurses libraries or the ** ...

  2. Python __slots__限制动态添加变量

    Python是一种非常灵活的动态语言,有时感觉太灵活以至于不知道遵循什么样的规则去驾驭.不过Python已经是非常完备的语言,想实现什么样的功能都是有方法的,而且也很容易,比如限制一个类动态添加成员变 ...

  3. join() ---- 使用四种不同的分隔符连接数组元素

    var a = ['Wind', 'Rain', 'Fire']; var myVar1 = a.join(); // myVar1的值变为"Wind,Rain,Fire" var ...

  4. C语言冷知识

    C语言属强类型语言(1)编程语言分2种:强类型语言和弱类型语言.强类型语言中所有的变量都有自己固定的类型,这个类型有固定的内存占用,有固定的解析方法:弱类型语言中没有类型的概念,所有变量全都是一个类型 ...

  5. vue 关键词模糊查询

    页面html,绑定的列表数据为datas,关键词为 select_words,如下图 其中d.accounts和d.roleName是需要进行搜索的字段,也可以进行大小写都可以

  6. 页面JS实现按钮点击增加输入框

    学习记录 https://www.tuicool.com/articles/byUf2qe

  7. DJango 基础 (5)

    模板加载静态文件 在settings.py文件中添加STATICFILES_DIRS,设置静态文件目录路径,同templates. # settings.py文件中​STATIC_URL = '/st ...

  8. as3:sprite作为容器使用时,最好不要指定width,height

    除 TextField 和 Video 对象以外,没有内容的显示对象(如一个空的 Sprite)的高度为 0,即使您尝试将 height 设置为其它值,也是这样. 如果您设置了 height 属性,则 ...

  9. python 网络编程 缓冲和粘包

    tcp:属于长连接,与一个客户端进行连接了以后,其他的客户端要等待,要连接另外一个,必须优雅的断开前面这个客户端的连接. 允许地址重用:在bind IP地址和端口之前加上,# server.setso ...

  10. 7za命令报错Error: xxx is not supported archive

    问题: 执行7za命令时报错:Error: xxx is not supported archive   原因: 当前7za版本过低   直接执行7za可以看到当前版本: 7-Zip (A) [64] ...