题目自定义了一个算法,模拟就可以AC

 

code:

#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
using namespace std;
char num1[15], num2[15];

int main()
{
    while((scanf("%s%s", num1, num2))!=EOF)
    {
        int n1=strlen(num1);
        int n2=strlen(num2);
        int sum(0);
        for(int i=0; i<n1; i++)
        {
            for(int j=0; j<n2; j++)
            {
                sum+=(num1[i]-'0')*(num2[j]-'0');
            }
        }
        printf("%d\n", sum);
    }
}

posted on 2011-01-01 00:16  FreeAquar  阅读(147)  评论(0编辑  收藏  举报