快速读入

    xiaoxiao2021-03-25  109

    在比赛时,有时cin,和scanf读入想对而言太慢,我们可以自定义入读方式如下

    //写一个读入数字的函数,检验比单纯写gets()要快 int readit() { int s; char t; t=getchar(); while(t<'0'||t>'9') t=getchar(); //过滤非数字 s=t-48; t=getchar(); while(t>='0'&&t<='9') { s=s*10+t-48; t=getchar(); } return s; }
    转载请注明原文地址: https://ju.6miu.com/read-18052.html

    最新回复(0)