UVA10106 Product(大数相乘)(Java题解)
UVA10106 Product(大数相乘)(Java题解)
Product
The Problem
The problem is to multiply two integers X, Y. (0<=X,Y<10250)
The Input
The input will consist of a set of pairs of lines. Each line in pair contains one multiplyer.
The Output
For each input pair of lines the output line should consist one integer the product.
Sample Input
12
12
2
222222222222222222222222
Sample Output
144
444444444444444444444444
代码如下:
import java.math.BigInteger; import java.util.Scanner; public class Main{ public static void main(String[] args){ Scanner s=new Scanner(System.in); while(s.hasNext()){ BigInteger a=s.nextBigInteger(); BigInteger b=s.nextBigInteger(); BigInteger c=a.multiply(b); System.out.println(c); } } }