AcWing 3390. 特殊乘法
原题链接
简单
作者:
浩然正气
,
2024-10-27 20:55:05
,
所有人可见
,
阅读 5
#include <stdio.h>
#include <string.h>
#define N 100010
typedef long long LL;
int main() {
char num1[N] = "";
char num2[N] = "";
LL a[N], b[N];
LL sum = 0, ans = 1;
scanf("%s", num1);
scanf("%s", num2);
for (int i = 0; i < strlen(num1); i ++ )
a[i] = num1[i] - '0';
for (int i = 0; i < strlen(num2); i ++ )
b[i] = num2[i] - '0';
for (int i = 0; i < strlen(num1); i ++ ) {
for (int j = 0; j < strlen(num2); j ++ ) {
ans = a[i] * b[j];
sum += ans;
}
}
printf("%lld\n", sum);
return 0;
}