题解
2026-09-14 21:17:46
发布于:浙江
2阅读
0回复
0点赞
请多指教
由于我懒得打高精度减法和除法,所以我用__int128类替换(long long位的两倍)
还要打快读快写因为__int128不支持cin,cout
输入:
__int128 read () {
__int128 w = 1, sum = 0;
char ch = getchar() ;
while ( ch < '0' || ch > '9' ) {
if ( ch == '-' ) {
w = -1 ;
}
ch = getchar () ;
}
while ( ch >= '0' && ch <= '9' ) {
sum = ( sum << 3 ) + ( sum << 1 ) + ( ch ^ 48 ) ;
ch = getchar () ;
}
return sum * w;
}
输出:
void write( __int128 x ) {
if ( x < 0 ) putchar ( '-' ) , x = -x;
if ( x > 9 ) write ( x / 10 ) ;
putchar ( x % 10 + '0' ) ;
}
然后定义一下就过了
//本人在读小学四年级
这里空空如也

有帮助,赞一个