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