Nine degrees OJ topic 1080: Binary conversion (Java) using BigInteger for binary conversion

Source: Internet
Author: User

Title Description:

Converts the number of M-binary x to the number output of n-binary.

Input:

The first line of input consists of two integers: M and N (2<=m,n<=36).
The following line enters a number x,x is the number of M-binary, and now requires you to convert the M-binary number x to the N-binary number output.

Output:

The number of the N-binary representation of the output x.

Sample input:
10F
Sample output:
15
Tips:

The letter portion of the input is uppercase, the output is lowercase, and there is big data.

 PackageA;ImportJava.math.BigInteger;ImportJava.util.*; Public classmain{ Public Static  voidMain (string[] args) {Scanner cin=NewScanner (system.in);  while(Cin.hasnext ()) {intm=Cin.nextint (); intn=Cin.nextint (); String Str=Cin.next (); String B1=NewBigInteger (str,m). toString (n);     System.out.println (B1);      } cin.close (); }  }

Nine degrees OJ topic 1080: Binary conversion (Java) using BigInteger for binary conversion

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.