嗯~~~這倆玩意 很毒瘤,可是也很管用數組
個人某位超級巨的巨佬有一次由於用了快讀,莫名其妙變30分,啦啦啦~~~spa
下面讓咱們來看看正確的快讀快寫code
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 }
這纔對嘛很管用!!!blog
不要像某位巨佬同樣哦~~~get
找到一個不要數組的快寫 666666666it
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 }