请编写”长整数相乘”程序,实现两个任意长度的长整数(正数)相乘,输出结果.
提示: 将长整数用一个字节链表表示,逐字节相乘,要考虑进位
乘数A = ∑Am*10m ( 0 ≤ m < ∞, 0 ≤ Am ≤ 9 ), 首位可以为0
乘数B = ∑Bn*10n ( 0 ≤ n < ∞, 0 ≤ Bn ≤ 9 ), 首位可以为0
Result = 乘数A *乘数B
Example1:
乘数A = 1*101 + 2*100 = 12 ( m = 1, A1 = 1, A0 = 2)
乘数B = 3*101 + 4*100 = 34 ( n = 1, B1 = 3, B0 = 4)
Example2:
乘数A = 0*102 + 0*101 + 0*100 = 000 ( m = 2, A2 = 0, A1 = 0, A0 = 0)
乘数B = 0*103 + 5*102 + 6*101 + 0*100 = 0560 ( n = 3, B3 = 0, B2 = 5, B1 = 6, B0 = 0)