poj3673,

## Problem:

Cow Multiplication

 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7792 Accepted: 5135

Description

Bessie is tired of multiplying pairs of numbers the usual way, so she invented her own style of multiplication. In her style, A*B is equal to the sum of all possible pairwise products between the digits of A and B. For example, the product 123*45 is equal to 1*4 + 1*5 + 2*4 + 2*5 + 3*4 + 3*5 = 54. Given two integers A and B (1 ≤ A, B ≤ 1,000,000,000), determine A*B in Bessie's style of multiplication.

Input

* Line 1: Two space-separated integers: A and B.

Output

* Line 1: A single line that is the A*B in Bessie's style of multiplication.

Sample Input
`123 45`

Sample Output
`54`

Source
USACO 2008 February Bronze

## Source Code:

//Sun 31 Jan 2010 02:03:36 PM CST
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main()
{
string s1;
string s2;
cin >> s1 >> s2;
int sum1 = 0;
int sum2 = 0;
int sz1 = s1.size();
int sz2 = s2.size();
for(int i=0; i<sz1; i++)
{
sum1 += s1[i]-'0';
}
for(int i=0; i<sz2; i++)
{
sum2 += s2[i]-'0';
}
cout << sum1*sum2 << endl;
return 0;
}
[/sourcecode]
{"ft_lang_label":"__label__en","ft_lang_prob":0.6208608,"math_prob":0.9921663,"size":1261,"snap":"2021-43-2021-49","text_gpt3_token_len":413,"char_repetition_ratio":0.09466985,"word_repetition_ratio":0.018518519,"special_character_ratio":0.3743061,"punctuation_ratio":0.17279412,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9927212,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-12-05T07:05:19Z\",\"WARC-Record-ID\":\"<urn:uuid:3e650b48-a272-4606-8e89-f805294386fa>\",\"Content-Length\":\"99621\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:ab2c043e-8883-401b-91a9-e33bda3a3df8>\",\"WARC-Concurrent-To\":\"<urn:uuid:528604bc-a738-43b4-912f-9436d9e9e43b>\",\"WARC-IP-Address\":\"172.217.164.147\",\"WARC-Target-URI\":\"http://code.antonio081014.com/2010/10/poj3673cowmultiplicationcpp.html\",\"WARC-Payload-Digest\":\"sha1:C74BGHU6QSEI6IHFHGWD2FK7YAJOYXE3\",\"WARC-Block-Digest\":\"sha1:V4Q4ZZ43YAETNKSXF2WAWTBYOHYJHGYZ\",\"WARC-Identified-Payload-Type\":\"application/xhtml+xml\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-49/CC-MAIN-2021-49_segments_1637964363149.85_warc_CC-MAIN-20211205065810-20211205095810-00049.warc.gz\"}"}