You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

850 B

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

快读快写

x << 1 == x * 2; 
x << 3 == x * 2 * 2 * 2;

二者相加也就是 x * 10;

(1) 设ch='3' ASCII= 51 = 00110011(b) (2) 字符 '0'  ASCII= 48 = 00110000(b)

^运算规则:同01,相同的两个数异或为0 不同的异或为1

ch^48 相当于 ch -= '0' ,得到 00000011,即数字3

//快读
inline int read() {
    int x = 0, f = 1;
    char ch = getchar();
    while (ch < '0' || ch > '9') {
        if (ch == '-') f = -1;
        ch = getchar();
    }
    while (ch >= '0' && ch <= '9') {
        x = (x << 3) + (x << 1) + (ch ^ 48);
        ch = getchar();
    }
    return x * f;
}

//快写
inline void write(int x) {
    if (x < 0) putchar('-'), x = -x;
    if (x > 9) write(x / 10);
    putchar(x % 10 + '0');
}