int read( ){
int ans=0,op=1;
char c;
c=getchar();
for(;(c<'0'||c>'9')&&c!='-';c=getchar());
if(c=='-') op=-1,c=getchar( );
for(;(c>='0'&&c<='9');c=getchar( )) ans*=10,ans+=c-'0';
return ans*op;
}
c^48==c-'0'
n=read();
使用getchar()
原文:https://www.cnblogs.com/liuziwen0224/p/11992368.html