板子-__int128

__int128 是比 long long 还要大的数据类型((max = 2^{128}-1)
其输入和输出不能用常规方法,用 read() 和 write() 函数代替

#include<bits/stdc++.h>

using namespace std;

__int128 read(int f = 1) {
    char ch = getchar();
    __int128 res = 0;
    while(ch > '9' || ch < '0') {
        if (ch == '-') f *= -1;
        ch = getchar();
    }
    while(ch <= '9' && ch >= '0') {
        res = res * 10 + (ch ^ 48);
        ch = getchar();
    }
    return res * f;
}

void write(__int128 n) {
    if (n < 0) {
        putchar('-');
        n *= -1;
    }
    if (n/10) write(n/10);
    putchar(n%10+'0');
}

int main() {
    __int128 n = read();
    write(n);
    return 0;
}

原文地址:https://www.cnblogs.com/yycx/p/14010350.html