PetroChina-High precision factorial-java

Source: Internet
Author: User

Question F: "High precision" high precision factorial time limit: 1 Sec memory limit: up to MB
Submitted: $ 13
Submitted State [Discussion Version]
Title description "Magic Magic Code" for the repair tabrets is so important, is because the "treasure" in the record a lot of magic principles. For example, a long time ago, the mainstream wizarding community believed that the legendary invisibility cloak was impossible to realize, their theory is that the light enters the human eye to cause the vision, if has the invisibility clothing existence, then the person because does not have the light to enter the eye also cannot see outside the situation. But later turned out of the "treasure" in the detailed description of several kinds of stealth clothing and the realization of the principle and successfully implemented.

Now, the king of Asura, according to the contents of the book to display the hidden magic, this hidden magic need to gather large dark elements, known to support the N-hour occult magic requires n! number of dark elements, for example, when n=5, n! =5x4x3x2x1=120. Now enter a number n, to find the factorial of N (n<10000) is how much n! is. Enter only one number, or N. Output output answer is n! sample input
3
Sample output
3!=6
Code:
ImportJava.math.BigInteger;ImportJava.util.Scanner; Public classMain { Public Static voidMain (string[] args) {Scanner sc=NewScanner (system.in); BigInteger BIG1=NewBigInteger ("1"); intA=Sc.nextint ();  for(inti=2;i<=a;i++) {BIG1=big1.multiply (biginteger.valueof (i)); } System.out.println (A+"!="+big1.tostring ()); }}

PetroChina-High precision factorial-java

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.