猫史档案馆


C++整数(int)读入优化

用户:博瀚君博瀚君查看:0 回复:2 评论:0 创建时间:2018-11-09T15:42:57


C++整数(int)读入优化

inline int getint(){
    char
ch;
    int res=0;
    while(ch=getchar(),ch<48||ch>57);
    res=ch-48;
    while(ch=getchar(),ch>47&&ch<58)res=(res<<3)+(res<<1)+ch-48;
    return res;
}


回复

上一页1 页 / 共 1下一页
Zhe_LearnZhe_Learn

-48换成&15会更快哦qwq

点赞0


评论


任波翰v任波翰v

inline int getint(){
    int ret;
    cin >> ret;
    return ret;
    //滑稽
}

点赞0


评论