基准时间限制:2 秒 空间限制:131072 KB 分值: 80
难度:5级算法题
给出2个大整数A,B,计算A*B的结果。
Input
第1行:大数A 第2行:大数B (A,B的长度 <= 100000,A,B >= 0)
Output
输出A * B
Input示例
123456 234567
Output示例
28958703552
感觉java真的特别适合写大数的题。比C语言好用多了
import java.*;
import java.math.*;
import java.util.Scanner;
public class Main{
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
BigInteger a = sc.nextBigInteger();
BigInteger b = sc.nextBigInteger();
BigInteger c = a.multiply(b);
System.out.println(c.toString());
}
}