#include <iostream>
//模10以取出个位,除/10可以去除个位
long int fun(long int x,long int y)
{
long int ans=0,y1;
while(y)
{
y1=y;
y1=y%10;
ans+=x*y1;
y=y/10;
}
return ans;
}
int main(void)
{
long int x,y,ans1=0,x1;
std::cin>>x>>y;
while(x)
{
x1=x;
x1%=10;
ans1+=fun(x1,y);
x/=10;
}
std::cout<<ans1<<std::endl;
return 0;
} #include <iostream>
#include <string>
using namespace std;
int main() {
string str1,str2;
int n = 0;
while ( cin >> str1 >> str2 ) {
for ( int i = 0 ; i < str1.size() ; i++ )
for ( int j = 0 ; j < str2.size() ; j++ )
n += (str1[i]-'0') * (str2[j]-'0');
cout << n << endl;
}
return 0;
} import java.util.Scanner;
public class Main02 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
String[] s = scanner.nextLine().split(" ");
char[] x = s[0].toCharArray();
char[] y = s[1].toCharArray();
int sum=0;
for (char x1 : x) {
for (char y1 : y) {
sum += (x1-'0') * (y1-'0');
}
}
System.out.println(sum);
}
} #include<iostream>
#include<cstdio>
using namespace std;
int main(){
string n1,n2;
int result = 0;
while(cin>>n1>>n2){
for(int i=0; i<n1.length(); i++){
for(int j=0; j<n2.length(); j++){
result += (n1[i]-'0')*(n2[j]-'0');//关键,char2int
}
}
cout<<result<<endl;
}
return 0;
} #include<iostream>
#include<cmath>
using namespace std;
int main() {
int a, b;
while (cin >> a >> b) {
bool judge_a = 0, judge_b = 0;
int a_max = 1, b_max = 1;
for (int i = 1; i <= 9; i++) {
if (pow(10, a_max)>a) {
judge_a = 1;
a_max--;
}
if (pow(10, b_max)>b) {
judge_b = 1;
b_max--;
}
if (judge_a == 1 && judge_b == 1)
break;
a_max++;
b_max++;
}
int result = 0;
for (int i = 0; i <= a_max; i++) {
int temp_a = (a % (int)pow(10, i + 1)) / (int)pow(10, i);
for (int j = 0; j <= b_max; j++) {
int temp_b = (b % (int)pow(10, j + 1)) / (int)pow(10, j);
result += temp_b*temp_a;
}
}
cout << result << endl;
}
} #include <iostream>
#include <stdio.h>
using namespace std;
int main(){
int A,B,sum=0,a[10]={0},b[10]={0};
while(cin>>A&&cin>>B){
int i=0,j=0;
while(A>=10){
a[i]=A%10;
i++;
A/=10;
}
a[i]=A;
while(B>10){
b[j]=B%10;
j++;
B/=10;
}
b[j]=B;
for(int n=0;n<=i;n++)
for(int m=0;m<=j;m++){
sum+=a[n]*b[m];
}
cout<<sum<<endl;
sum=0;
}
return 0;
}
#include<iostream>
#include<cstdio>
using namespace std;
int main()
{
string str1, str2;
while(cin >> str1 >> str2)
{
int sum = 0;
for(int i = 0; i < str1.length(); ++i)
{
for(int j = 0; j < str2.length(); ++j)
{
sum += (str1[i]-'0')*(str2[j]-'0');
}
}
cout << sum << endl;
}
return 0;
}
#include<stdio.h>
int main (int argc, char *argv[]){
int a,b,res,ta,tb;
for(;~scanf("%d %d",&a,&b);){
for(res=0,ta=a;ta>0;ta/=10)
for(tb=b;tb>0;tb/=10)
res += (ta%10)*(tb%10);
printf("%d\n",res);
}
}
//输入字符串,把输入的字符串转化成整形数组,然后相乘
#include<stdio.h>
(737)#include<string.h>
int main()
{
char c1[11],c2[11];//数字可能太大int装不下所以用char
int a1[11],a2[11];
scanf("%s",c1);scanf("%s",c2);
int n1,n2,i,j,sum=0;
n1=strlen(c1);n2=strlen(c2);
//字符数组变成整形数组
for(i=0;i<n1;i++)
{a1[i]=c1[i]-'0';}
for(i=0;i<n2;i++)
{a2[i]=c2[i]-'0';}
//两个数组各个位置相乘累加
for(i=0;i<n1;i++)
for(j=0;j<n2;j++)
sum+=a1[i]*a2[j];
printf("%d",sum);
} //求类似123*45=1*4+1*5+2*4+2*5+3*4+3*5的结果
//输入两个数,输出特殊乘法的结果
#include<iostream>
using namespace std;
int main()
{
int x,y;
int tempx,tempy;
while(cin>>x>>y)
{
tempx = 0;
tempy = 0;
while(x)
{
tempx += x%10;
x /= 10;
}
while(y)
{
tempy += y%10;
y /= 10;
}
int ans = tempx *tempy;
cout<<ans<<endl;
}
return 0;
} #include <iostream>
#include <string>
using namespace std;
int main(){
string x,y;
while(cin>>x>>y){
int ans=0;
for(int i=0;i<x.size();i++){
for(int j=0;j<y.size();j++){
ans+=(x[i]-'0')*(y[j]-'0');
}
}
cout<<ans;
}
return 0;
}
#include <iostream>
#include <vector>
using namespace std;
vector<int> count(long long n) {
vector<int> vc;
while (n > 0) {
vc.push_back(n % 10);
n = n / 10;
}
return vc;
}
int main() {
long long a, b;
cin >> a >> b;
vector<int> ac = count(a);
vector<int> bc = count(b);
long long res = 0;
for (int i : ac) {
for (int j : bc) {
res += i * j;
}
}
cout << res << endl;
return 0;
}