现在的位置: 首页 > 综合 > 正文

poj 3673 Cow Multiplication

2012年11月14日 ⁄ 综合 ⁄ 共 257字 ⁄ 字号 评论关闭
#include <iostream>
#include <string>
using namespace std;

int main()
{
    string str1, str2;
    int i, j, len1, len2, ans = 0;
    cin >> str1 >> str2;
    len1 = str1.length();
    len2 = str2.length();
    for (i = 0; i < len1; i++)
       for (j = 0; j < len2; j++)
           ans += (str1[i]-48) * (str2[j]-48);
    cout << ans << endl;
    
    system("pause");
}

抱歉!评论已关闭.