题解 | #特殊乘法#
特殊乘法
https://www.nowcoder.com/practice/a5edebf0622045468436c74c3a34240f
#include <stdio.h> // 计算字符串长度: int Length(char a[]) { int n = 0; for (int i = 0; a[i] != '\0'; i++) { n++; } return n; } int main() { char Arr[9] = ""; char Brr[9] = ""; while ((scanf("%s%s", Arr, Brr)) != EOF) { int sum = 0; int p = Length(Arr); int q = Length(Brr); for (int i = 0; i < p; i++) { for (int j = 0; j < q; j++) { sum += (Arr[i] - '0') * (Brr[j] - '0'); } } printf("%d\n", sum); } return 0; }