Download presentation
Presentation is loading. Please wait.
1
1 10106:Product ★☆☆☆☆ 題組: Contest Archive with Online Judge 題號: 10106: Product 解題者:李育賢 解題日期: 2009 年 5 月 13 日 題意: 題目會給兩個數字 X,Y (0<= X,Y<10 250 ) , 需要輸出兩數相乘的值。
2
2 題意範例: Sample Input: 12 2 222222222222222222222222 Sample Output: 144 444444444444444444444444
3
3 解法: 以陣列模擬乘法運算即可。
4
4 討論: 使用 Java 的提供的大數,可省下不少 coding 時間。 範例: import java.math.BigInteger; import java.util.Scanner; public class P10106 { public static Scanner cin=new Scanner(System.in); public static void main(String args[]) { while(cin.hasNext()) { BigInteger a=new BigInteger(cin.nextLine()); BigInteger b=new BigInteger(cin.nextLine()); System.out.println(a.multiply(b)); }
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.