Unverified Commit 9cc00170 authored by 雷蒻's avatar 雷蒻 Committed by GitHub
Browse files

Merge pull request #1703 from CBW2007/patch-2

Update bignum.md
parents a52bbb75 86b63d6f
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -274,7 +274,11 @@ void sub(int a[LEN], int b[LEN], int c[LEN]) {

试一试,输入 `1 2` ——输出 `/9999999` ,诶这个 OI Wiki 怎么给了我一份假的代码啊……

如你所见,上面的程序只能处理 $a \geq b$ 的情况,至于负数如何处理——就交给聪明的你啦。
事实上,上面的代码只能处理减数 $a$ 大于等于被减数 $b$ 的情况。处理被减数比减数小,即 $a<b$ 时的情况很简单。

 $a-b=-(b-a)$ 

要计算 $b-a$ 的值,因为有 $b>a$ ,可以调用以上代码中的 `sub` 函数,写法为 `sub(b,a,c)` 。要得到 $a-b$ 的值,在得数前加上负号即可。

### 乘法