题解 | 特殊乘法
特殊乘法
https://www.nowcoder.com/practice/a5edebf0622045468436c74c3a34240f
#include <iostream>
using namespace std;
int main() {
int n,m,sum=0;
cin>>n>>m;
int begin_m=m;//存放m初始值,后续需要恢复m的
int temp_n,temp_m;
while(n!=0)
{
temp_n=n%10;
m=begin_m;
while(m!=0)
{
temp_m=m%10;
sum+=temp_n*temp_m;
m/=10;
}
n/=10;
}
cout<<sum;
}
// 64 位输出请用 printf("%lld")
查看11道真题和解析