首页 > 代码库 > 输入输出外挂

输入输出外挂

/* 仅适合纯数字输入输出 */
#include <cstdio>

int Scan() {    //输入外挂
    int res = 0, flag = 0;
    char ch;
    if((ch = getchar()) == '-') flag = 1;
    else if(ch >= '0' && ch <= '9') res = ch - '0';
    while((ch = getchar()) >= '0' && ch <= '9')
        res = res * 10 + (ch - '0');
    return flag ? -res : res;
}

void Out(int a) {    //输出外挂
    if(a < 0) { putchar('-'); a = -a; }
    if(a >= 10) Out(a / 10);
    putchar(a % 10 + '0');
}

int main() {
    int T, n;
    scanf("%d", &T);
    while(T--) {
        n = Scan();
        Out(n);
        printf("\n");
    }
    return 0;
}

输入输出外挂