DreamNotFoundl @ 2024-03-28 13:44:01
#include<bits/stdc++.h>
using namespace std;
const int N = 2e3 + 10;
char a1[N], b1[N];
int a[N], b[N], c[N << 1];
void lhxlsl(int a[N], char b[N], int n) {
for (int i = 0; i < n; ++i) {
a[n - i] = b[i] - '0';
}
}
int main() {
int lhx, lsl, ys, pa;
scanf("%s%s", a1, b1);
lhx = strlen(a1);
lsl = strlen(b1);
lhxlsl(a, a1, lhx);
lhxlsl(b, b1, lsl);
for (int i = 1; i <= lhx; ++i) {
pa = 0;
for (int j = 1; j <= lsl; ++j) {
c[i + j - 1] = a[i] * b[i] + pa + c[i + j - 1];
pa = c[i + j - 1] / 10;
c[i + j - 1] %= 10;
}
c[i + lsl] = pa;
}
ys = lhx + lsl;
while (c[ys] == 0 && ys > 1)ys--;
for (int i = ys; i >= 1; --i) printf("%d", c[i]);
return 0;
}
哪里哪里有毛病
by I_Love_DS @ 2024-03-28 14:05:14
你改变函数需要加引用吧
by I_Love_DS @ 2024-03-28 14:37:04
@DreamNotFoundl
by DreamNotFoundl @ 2024-03-29 18:11:50
@liuruiqing 谢谢大佬