#include<bits/stdc++.h>
using namespace std;

string c,d; 
vector<string> e;

string jia(string a, string b)
{
	if(a.size() < b.size()) return jia(b,a);
	int la = a.size();
	int lb = b.size();
	string temp;
	int t = 0;
	for(int i = 0; i < la; i++)
	{
		if(i < lb)	t += b[lb - i - 1] - '0';
		t += a[la - i - 1] - '0';
		temp += '0' + (t%10);
		t /= 10;
	}
	if(t) temp += '0' + t;
	reverse(temp.begin(), temp.end());
	return temp;
}

string cheng(string a, string b)
{
	if(a.size() < b.size()) return cheng(b,a);
	int la = a.size();
	int lb = b.size();
	string all;
	for(int i = 0; i < lb; i++)
	{
		string temp = "0";
		for(int j = 0; j < la; j++)
		{
			int t = 0;
			t += (a[la - j - 1] - '0') * (b[lb - i - 1] - '0');
			temp[j] += t%10;
			temp += '0' + t / 10;
		}
		while(temp[temp.size() - 1] == '0' && temp.size() > 1) temp.pop_back();
		reverse(temp.begin(), temp.end());
		for(int k = 0; k < i; k++) temp += '0';
		all = jia(all, temp);
	}
	return all;
}

int main()
{
	cin >> c >> d;
	
	string ans = cheng(c,d);
	cout << ans << endl;
	
	return 0;
}

0 comments

No comments so far...