Suseoj 1207: Multiplication of large integers (Java, multiply by large number)

Source: Internet
Author: User

1207: Multiplication time limit for large integers : 1 Sec memory limit: MB
Submissions: 7 Resolution: 2
Submitted State [Discussion Version] [Propositional person:Liyuansong] The title describes the product of two non-negative integers not exceeding 200 bits. The input has two lines, each of which is a non-negative integer of no more than 200 bits, with no extra leading 0. Outputs a row, that is, the result after multiplying. The result can not have redundant leading 0, that is, if the result is 342, then you cannot output to 0342. Sample input
1234567890098765432100
Sample output
1219326311126352690000

Analysis:
Use Java's BigInteger class to solve

Core code:
  
1 a = Sc.nextbiginteger (); 2 b = Sc.nextbiginteger (); 3 System.out.println (A.NULTIPLT (b));

Java code Implementation (AC):

1 ImportJava.math.BigInteger;2 ImportJava.util.Scanner;3 4 5  Public classmain{6      Public Static voidMain (String args[]) {7Scanner sc =NewScanner (system.in);8 BigInteger A, b;9A =Sc.nextbiginteger ();Tenb =Sc.nextbiginteger (); One System.out.println (a.multiply (b)); A      } -}

Suseoj 1207: Multiplication of large integers (Java, multiply by large number)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.