scanf很快
但是getchar更快~
输入挂(有时能用上):
1 int read(){ 2 int res = 0; 3 char c; 4 while(c=getchar(), c<'0'||c>'9'); 5 res = c-'0'; 6 while( c=getchar(),c>='0'&&c<='9' ) res = res*10+c-'0'; 7 return res; 8 }
博客园 © 2004-2025 浙公网安备 33010602011771号 浙ICP备2021040463号-3