N!
Time limit:10000/5000 MS (java/others) Memory limit:262144/262144 K (java/others)
Total submission (s): 73503 Accepted Submission (s): 21308
Problem Descriptiongiven an integer n (0≤n≤10000), your task is to calculate N!
Inputone N in one line, process to the end of file.
Outputfor each n, output N! In one line.
Sample Input123
Sample Output126
Authorjgshining (Aurora Dazzle)
ImportJava.io.*;ImportJava.math.BigInteger;ImportJava.util.*; Public classMain { Public Static voidMain (string[] args) {//TODO auto-generated Method StubScanner cin=NewScanner (NewBufferedinputstream (system.in)); PrintWriter cout=NewPrintWriter (System.out); intT; //T=cin.nextint (); //int eg=1; while(Cin.hasnextint ()) {T=Cin.nextint (); BigInteger One=NewBigInteger ("1"); BigInteger ans=One ; BigInteger tmp=One ; for(inti=0;i<t;i++) {ans=ans.multiply (TMP); TMP=Tmp.add (one); } //System.out.println (ans);System.out.println (ans); } }}View Code
Direct Java large number, note to read to the end of the file line.
HDU 1042 N! Java large number and judge file end