题解 | #特殊乘法#
特殊乘法
http://www.nowcoder.com/practice/a5edebf0622045468436c74c3a34240f
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
int main(){
int a,b;
int rs=0;
scanf("%d %d",&a,&b);
while(a!=0){
int a1=a%10;
int b1=b;
while(b1!=0){
int b2=b1%10;
rs+=a1*b2;
b1=b1/10;
}
a/=10;
}
printf("%d",rs);
return 0;
}
rs必须赋初值=0,不然结果错误(牛客上会大2)