嗯~~~这俩玩意 很毒瘤,但是也很管用
我的某位超级巨的巨佬有一次因为用了快读,莫名其妙变30分,啦啦啦~~~
下面让我们来看看正确的快读快写
1 int buf[17]; 2 inline void read(int &x){ 3 char ch=getchar(); x=0; 4 while(ch<'0') ch=getchar(); 5 while(ch>='0' && ch<='9') x=(x<<1)+(x<<3)+(ch^48),ch=getchar(); 6 } 7 inline void write(int x){ 8 if(!x){putchar('0');putchar('\n');return;} 9 register int cnt=0; 10 while(x)buf[++cnt]=(x%10)+48,x/=10; 11 while(cnt)putchar(buf[cnt--]); 12 putchar('\n'); 13 }
这才对嘛很管用!!!
不要像某位巨佬一样哦~~~
找到一个不要数组的快写 666666666
1 inline void write(int x){ 2 int y=10,len=1; 3 while(y<=x) {y*=10;len++;} 4 while(len--){y/=10;putchar(x/y+48);x%=y;} 5 }