Input hang (reduce time)

int Scan()

{

    int res = 0, ch, flag = 0;

    if ((ch = getchar()) == ' - ' )              // Determine positive and negative 

        flag = 1 ;

    else  if (ch >= ' 0 ' && ch <= ' 9 ' )            // get the complete number 

        res = ch - ' 0 ' ;

    while((ch = getchar()) >= '0' && ch <= '9' )

        res = res * 10 + ch - '0';

    return flag ? -res : res;

}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325180129&siteId=291194637