#include <iostream> using namespace std; int main() { string str1, str2; int sum = 0; char a = '0'; while (cin >> str1 >> str2) { //用cin for (int i = 0; i < str1.size(); i++) { for (int j = 0; j < str2.size(); j++) { //char a='0'; // printf("%d",a);//注意此处字符转换,0的ASCII码不是0,是48 sum = sum + ((int)str1[i] - (int)a) * ((int)str2[j] - (int)a); } } cout << sum << endl; } }