zoukankan      html  css  js  c++  java
  • qau国庆七天乐——B

     
    B - Bull Math
     
    Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%lld & %llu

    Description

    Bulls are so much better at math than the cows. They can multiply huge integers together and get perfectly precise answers ... or so they say. Farmer John wonders if their answers are correct. Help him check the bulls' answers. Read in two positive integers (no more than 40 digits each) and compute their product. Output it as a normal number (with no extra leading zeros). 

    FJ asks that you do this yourself; don't use a special library function for the multiplication.

    Input

    * Lines 1..2: Each line contains a single decimal number.

    Output

    * Line 1: The exact product of the two input lines

    Sample Input

    11111111111111
    1111111111

    Sample Output

    12345679011110987654321
    import java.math.BigInteger;
    import java.util.Scanner;
    
    public class Main {
        public static void main(String[] args) {
            Scanner cin = new Scanner(System.in);
            while (cin.hasNext()) {
                BigInteger  n = cin.nextBigInteger();
                BigInteger  m = cin.nextBigInteger();
                System.out.println(n.multiply(m));
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          
                
            }
        }
    }
     
     
     
  • 相关阅读:
    2019.8.30 玉米田
    2019暑假集训 最短路计数
    2019暑假集训 旅行计划
    2019暑假集训 文件压缩
    0033-数字和星期转换
    0032-分数等级转换
    0031-闰年判断
    0030-购买衣服
    0029-求最小的数
    0028-判断奇偶
  • 原文地址:https://www.cnblogs.com/upstart/p/5950829.html
Copyright © 2011-2022 走看看