__int128输出

std::ostream& operator<<(std::ostream& os, __int128 t) {
    if (t==0) return os << "0";
    if (t<0) {
        os<<"-";
        t=-t;
    }
    int a[50],ai=0;
    memset(a,0,sizeof a);
    while (t!=0){
        a[ai++]=t%10;
        t/=10;
    }
    for (int i=1;i<=ai;i++) os<<abs(a[ai-i]);
    return os<<"";
}

void print(__int128 x)
{
    if (x>9) print(x/10);
    putchar('0'+x%10);
}

猜你喜欢

转载自blog.csdn.net/algzjh/article/details/81489436
128