码迷,mamicode.com
首页 > 其他好文 > 详细

fastIO模板

时间:2017-09-11 10:08:41      阅读:173      评论:0      收藏:0      [点我收藏+]

标签:color   ret   pen   ==   for   blank   amp   error   end   

freadIO整理

 1 namespace fastIO{
 2     #define BUF_SIZE 100000
 3     bool IOerror=0;
 4     inline char nc() {
 5         static char buf[BUF_SIZE],*p1=buf+BUF_SIZE,*pend=buf+BUF_SIZE;
 6         if(p1==pend){
 7             p1=buf;
 8             pend=buf+fread(buf,1,BUF_SIZE,stdin);
 9             if(pend==p1){
10                 IOerror=1;
11                 return -1;
12             }
13         }
14         return *p1++;
15       }
16       inline bool blank(char ch) {
17           return ch== ||ch==\n||ch==\r||ch==\t;
18       }
19       inline void read(int &x) {
20           char ch;
21           while(blank(ch=nc()));
22           if(IOerror)    return;
23           for(x=ch-0;(ch=nc())>=0&&ch<=9;x=(x<<3)+(x<<1)+ch-0);
24       }
25       #undef BUF_SIZE
26   };
27 using namespace fastIO;

 

fastIO模板

标签:color   ret   pen   ==   for   blank   amp   error   end   

原文地址:http://www.cnblogs.com/elpsycongroo/p/7503097.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!