1. 程式人生 > >快速讀模板

快速讀模板

fread pan closed tdi read tail 其它 line urn

不能與其它輸入流混用

技術分享圖片
 1 inline char getChar() {
 2     static char str[300000];
 3     static int head = 0, tail = 0;
 4     if (head == tail) {
 5         tail = fread(str, 1, 300000, stdin);
 6         head = 0;
 7     }
 8     return str[head++];
 9 }
10 inline int get_int() {
11     int res = 0; char c = getChar();
12
while (!isdigit(c)) c = getChar(); 13 while (isdigit(c)) res = res * 10 + c - 0, c = getChar(); 14 return res; 15 }
View Code

快速讀模板