写个算法,对2个小于1000000000的输入,求结果。特殊乘法举例:123 * 45 = 1*4 +1*5 +2*4 +2*5 +3*4+3*5
import java.util.*;
public class Main {
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
char[] str1=new char[100];
char[] str2=new char[100];
int result=0;
while(sc.hasNext()){
String input1=sc.nextLine();
System.out.println(input1);
String[] str=input1.split(" ");
if(Integer.parseInt(str[0])>1000000000 || Integer.parseInt(str[1])>1000000000)
System.out.println("输入错误");
str1=str[0].toCharArray();
str2=str[1].toCharArray();
for(int i=0;i<str1.length;i++){
for(int j=0;j<str2.length;j++){
result+=(str1[i]-'0')*(str2[j]-'0');
}
}
System.out.println(result);
result=0;
}
}
}