题解 | #特殊乘法#
特殊乘法
https://www.nowcoder.com/practice/a5edebf0622045468436c74c3a34240f
#include <cstdio> #include <string> using namespace std; int main() { int arr1; int arr2; while (scanf("%d%d", &arr1, &arr2) != EOF) { int sum = 0; string str2 = to_string(arr2); string str1 = to_string(arr1); for (int i = 0; i < str1.size(); i++) { for (int j = 0; j < str2.size(); j++) { sum = sum + (str1[i] - '0') * (str2[j] - '0'); } } printf("%d", sum); } }