c++读入优化

由Qiu.YF提供读入优化代码 多码几遍就会了



#include<iostream>
#include<cstdio>
#include<cctype>

    using namespace std;
    #define in = read()
    typedef long long ll;
    const ll size = ;

inline ll read(){
        ll num = 0 , f = 1;   char ch = getchar();

        while(!isdigit(ch)){
                if(ch == '-')   f = -1;
                ch = getchar();
        }

        while(isdigit(ch)){
                num = num*10 + ch - '0';
                ch = getchar();
        }

        return num*f;
}

int main(){

}


//COYG

isdigit 判断 ch 是不是在’0’-‘9’之间

posted @ 2017-05-25 19:37  ars4me  阅读(137)  评论(0)    收藏  举报