Product - UVa 10106 高精度

来源:互联网 发布:知乎 停车 编辑:程序博客网 时间:2024/05/14 23:58

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

12122222222222222222222222222

Sample Output

144444444444444444444444444

题意:算大乘法。

思路:感觉这类的东西用java的高精度so easy!!【可能是作死

           虽然JAVA比较慢,但是JAVA的高精度真的很赞。

JAVA AC代码如下:

import java.math.BigInteger;import java.util.Scanner;public class Main{ public static void main(String [] args) { Scanner scan=new Scanner(System.in);  while(scan.hasNextBigInteger())  { BigInteger a=scan.nextBigInteger();    BigInteger b=scan.nextBigInteger();    BigInteger c=b.multiply(a);    System.out.println(c);  }}}




0 0
原创粉丝点击