inline int input()
{
int c;
int n = 0;
while ((c = getchar_unlocked()) >= '0' && c <= '9')
{
// n = 10 * n + (c - '0');
n = (n << 3) + (n << 1) + c - '0';
}
return n;
}
有人可以解釋如何輸入數字的這種方式工作,以及它是如何快速輸入數字?c/C++中快速輸入數字的方法?
@KerrekSB:完全錯過了微觀優化機會,擺脫了循環中的兩個比較... – PlasmaHH