read()快速读入

    科技2025-12-21  10

    @toc

    整数读入

    可读入正负数

    #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace std; inline int read(){ int s = 0, w = 1; char c = getchar(); while (c < '0' || c > '9'){ if (c == '-') w = -1; c = getchar(); } while (c >= '0' && c <= '9') s = s * 10 + c - '0', c = getchar(); return s*w; } int main(){ cout << read() << endl; return 0; }
    Processed: 0.035, SQL: 9