zoukankan      html  css  js  c++  java
  • 读入挂

    fastIO读入挂:

     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         }return *p1++;
    14     }
    15     inline bool blank(char ch){
    16         return ch==' '||ch=='
    '||ch=='
    '||ch=='	';
    17     }
    18     inline bool read(int &x){
    19         char ch;
    20         while(blank(ch=nc()));
    21         if(IOerror)return 0;
    22         for(x=ch-'0';(ch=nc())>='0'&&ch<='9';x=x*10+ch-'0');
    23         return 1;
    24     }
    25     #undef BUF_SIZE
    26 };

    fread读入挂:

     1 const int BUF=40000000;
     2 char Buf[BUF],*buf=Buf;
     3 const int OUT=20000000;
     4 char Out[OUT],*ou=Out;int Outn[30],Outcnt;
     5 inline void write(int x){
     6   if(!x)*ou++=48;
     7   else{
     8     for(Outcnt=0;x;x/=10)Outn[++Outcnt]=x%10+48;
     9     while(Outcnt)*ou++=Outn[Outcnt--];
    10   }
    11 }
    12 inline void writell(ll x){
    13   if(!x)*ou++=48;
    14   else{
    15     for(Outcnt=0;x;x/=10)Outn[++Outcnt]=x%10+48;
    16     while(Outcnt)*ou++=Outn[Outcnt--];
    17   }
    18 }
    19 inline void writechar(char x){*ou++=x;}
    20 inline void writeln(){*ou++='
    ';}
    21 inline void read(int&a){for(a=0;*buf<48;buf++);while(*buf>47)a=a*10+*buf++-48;}
    22 
    23 
    24 //这句话放到代码中
    25 fread(Buf,1,BUF,stdin);
    26 fwrite(Out,1,ou-Out,stdout);
    27 //样例
    28 #include<bits/stdc++.h>
    29 using namespace std;
    30 typedef long long ll;
    31 const int BUF=40000000;
    32 char Buf[BUF],*buf=Buf;
    33 const int OUT=20000000;
    34 char Out[OUT],*ou=Out;int Outn[30],Outcnt;
    35 inline void write(int x){
    36   if(!x)*ou++=48;
    37   else{
    38     for(Outcnt=0;x;x/=10)Outn[++Outcnt]=x%10+48;
    39     while(Outcnt)*ou++=Outn[Outcnt--];
    40   }
    41 }
    42 inline void writell(ll x){
    43   if(!x)*ou++=48;
    44   else{
    45     for(Outcnt=0;x;x/=10)Outn[++Outcnt]=x%10+48;
    46     while(Outcnt)*ou++=Outn[Outcnt--];
    47   }
    48 }
    49 inline void writechar(char x){*ou++=x;}
    50 inline void writeln(){*ou++='
    ';}
    51 inline void read(int&a){for(a=0;*buf<48;buf++);while(*buf>47)a=a*10+*buf++-48;}
    52 
    53 int main(){
    54     fread(Buf,1,BUF,stdin);
    55     int a,b;
    56     read(a),read(b);
    57     write(a+b);
    58     writeln();
    59     fwrite(Out,1,ou-Out,stdout);
    60 }
  • 相关阅读:
    微信开发 之 开启开发模式
    微信公众号开发 之 编辑模式使用
    分析各种Android设备屏幕分辨率与适配
    【面向对象设计模式】 适配器模式 (二)
    重构 之 总结代码的坏味道 Bad Smell (一) 重复代码 过长函数 过大的类 过长参数列 发散式变化 霰弹式修改
    【Android 应用开发】Android资源文件
    java 创建并写入文件
    隐藏 HttpClient 在console的日志
    HOW TO CHANGE THE DEFAULT KEY-VALUE SEPARATOR OF A MAPREDUCE JOB
    java 时间戳转换
  • 原文地址:https://www.cnblogs.com/weeping/p/7423109.html
Copyright © 2011-2022 走看看