acm hdu p1402 A * B Problem Plus 水題

A * B Problem Plus

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 15027    Accepted Submission(s): 2907


Problem Description
Calculate A * B.
 


Input
Each line will contain two integers A and B. Process to end of file.

Note: the length of each integer will not exceed 50000.
 


Output
For each case, output A * B in one line.
 


Sample Input
1 2 1000 2
 


Sample Output
2 2000




此題用java中的最大精度  既可以求解


package HDU;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Scanner;
public class p1402 {
	public static void main(String[] args) {
       Scanner sc=new Scanner(System.in);
       while(sc.hasNext()){
    	  BigDecimal a=sc.nextBigDecimal();
    	  BigDecimal b=sc.nextBigDecimal();
    	   
    	   System.out.println(a.multiply(b));
       }
	}

}







發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章