执行用时:4ms
内存消耗:1.38MB
击败了99.86%的用户
击败了100.00%的用户
#include <unistd.h>
static char inBuf[1 << 16];
static int inLen = 0, inPos = 0;
inline int readChar() {
if (inPos == inLen) {
inLen = read(0, inBuf, sizeof(inBuf));
inPos = 0;
if (inLen <= 0) return -1;
}
return inBuf[inPos++];
}
static char outBuf[1 << 16];
static int outLen = 0;
inline void outChar(char c) {
outBuf[outLen++] = c;
if (outLen == (int)sizeof(outBuf)) {
write(1, outBuf, outLen);
outLen = 0;
}
}
inline void outInt(int v) {
char tmp[12];
int tl = 0;
if (v == 0) tmp[tl++] = '0';
else while (v) { tmp[tl++] = '0' + v % 10; v /= 10; }
while (tl) outChar(tmp[--tl]);
}
int main() {
int t = 0;
int c = readChar();
while (c <= ' ') c = readChar();
while (c > ' ') { t = t * 10 + (c - '0'); c = readChar(); }
}