小水一道
有两个数 A and B (1 ≤ A, B ≤ 1,000,000,000), 作如下运算,例如:123*45 is equal to 1*4 + 1*5 + 2*4 + 2*5 + 3*4 + 3*5 = 54.
#include <cstdio>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <fstream>
#include <math.h>
#include <algorithm>
#define INF 0x3f3f3f3f
using namespace std;
char a[11],b[11];
int sum;
int main()
{
//freopen ("input.txt","r",stdin);
scanf("%s %s",a,b);
sum=0;
int l1=strlen(a),l2=strlen(b);
for(int i=0;i<l1;i++)
for(int j=0;j<l2;j++)
sum+=(a[i]-'0')*(b[j]-'0');
cout<<sum<<endl;
return 0;
}