正式AFO @ 2018-09-25 21:40:39
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int main(){
char a1[100000], b1[100000];
int a[100000], b[100000], c[100000], lena, lenb, lenc, i, j, x;
memset(a, 0, sizeof(a));
memset(b, 0, sizeof(b));
memset(c, 0, sizeof(c));
scanf("%s%s", &a1, &b1);
lena = strlen(a1);
lenb = strlen(b1);
for(i = 0; i < lena; i++)
a[lena - i] = a1[i] - 48;
for(i = 0; i < lenb; i++)
b[lenb - i] = b1[i] - 48;
for(i = 1; i <= lena; i++){
x = 0;
for(j = 1; j <= lenb; j++){
c[i + j -1] = a[i] * b[i] + x + c[i + j - 1];
x = c[i + j - 1] / 10;
c[i + j -1] %= 10;
}
c[i + lenb] = x;
}
lenc = lena + lenb;
while(c[lenc] == 0 && lenc > 1)
lenc--;
for(i = lenc; i >= 1; i--)
cout << c[i];
cout << endl;
return 0;
}
by doufive_11 @ 2018-09-25 21:43:45
前排
by LaWekokomidy @ 2018-09-25 21:44:53
scanf读字符串不用加取地址符吧?
by 正式AFO @ 2018-09-27 19:59:44
那也是一样啊?
by 正式AFO @ 2018-09-29 21:22:27
@夏之哀伤
by 正式AFO @ 2018-09-29 21:22:39
@doufive_11
by 正式AFO @ 2018-09-29 21:23:07
怎么办,我好难过。