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);
  }
 }
}
版权声明:本文为jianqiao123原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/jianqiao123/p/11202428.html