爆蛋求助

P4777 【模板】扩展中国剩余定理(EXCRT)

@[cannotdp](/user/190931) 改成int128后变成24分了( 这题好像卡ll,我当时就被卡了
by rmzls @ 2023-02-18 17:16:19


@[cannotdp](/user/190931) 是不是没有取模
by rmzls @ 2023-02-18 17:18:46


@[rmzls](/user/261574) 感谢,刚才已经过了
by cannotdp @ 2023-02-18 17:24:45


@[cannotdp](/user/190931) 坏了,我忘记为什么求出来的x要取模a/d了,能跟我讲下吗( (变量就是你代码里的
by rmzls @ 2023-02-18 17:34:58


@[cannotdp](/user/190931) 好像是exgcd里将解取最小的步骤(?)原来我exgcd忘了啊,那没事了(
by rmzls @ 2023-02-18 17:39:07


@[rmzls](/user/261574) 因为题目要求最小非负整数 $x$,而 $$ ax+by=c $$ 的通解是 $$ y=\frac{c}{d}y_0-k\frac{a}{d} $$ 所以要使 $y$ 最小就直接让它 $\bmod \frac{a}{d}$
by cannotdp @ 2023-02-18 17:43:54


@[cannotdp](/user/190931) 草草草,说错了
by cannotdp @ 2023-02-18 17:46:45


@[rmzls](/user/261574) $$ x=\frac{c}{d}x_0+k\frac{b}{d} $$ 这里的 $b$ 在我的代码里实际上是 $a$
by cannotdp @ 2023-02-18 17:47:41


@[cannotdp](/user/190931) 懂了,感谢大佬
by rmzls @ 2023-02-18 17:51:04


|