读入优化

1 int read(){
2     int f=1;int x=0;char s=getchar();
3     while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
4     while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
5     x*=f;
6     return x;
7 }
原文地址:https://www.cnblogs.com/lcan/p/9570794.html