回答編集履歴
1
バグ修正
test
CHANGED
@@ -30,11 +30,15 @@
|
|
30
30
|
|
31
31
|
}
|
32
32
|
|
33
|
+
listnew[i+digit2] += carry;
|
34
|
+
|
35
|
+
carry = 0;
|
36
|
+
|
33
37
|
}
|
34
38
|
|
35
39
|
int k = digit1 + digit2 - 1;
|
36
40
|
|
37
|
-
if (
|
41
|
+
if (listnew[k]) k++;
|
38
42
|
|
39
43
|
return k;
|
40
44
|
|
@@ -50,11 +54,11 @@
|
|
50
54
|
|
51
55
|
int list1[10] = { 3, 2, 1 }, list2[10] = { 3, 2, 1 };
|
52
56
|
|
53
|
-
int listnew[
|
57
|
+
int listnew[22] = { 0 };
|
54
58
|
|
55
59
|
int k = multiply(n1, n2, list1, list2, listnew);
|
56
60
|
|
57
|
-
for (int i = k; --i >= 0; ) pr
|
61
|
+
for (int i = k; --i >= 0; ) putchar(listnew[i] + '0');
|
58
62
|
|
59
63
|
putchar('\n');
|
60
64
|
|