输入输出外挂
程序员文章站
2024-03-17 16:22:46
...
仅适合纯数字
代码:
/* 仅适合纯数字输入输出 */
#include <cstdio>
int Scan() { //输入外挂
int res = 0, flag = 0;
char ch;
while((ch=getchar()),ch != '-'&&(ch< '0'||ch>'9'));
if(ch=='-') flag = 1;
else 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;
}
上一篇: Android编译环境(转)