HDU 1042 N! Java large number and judge file end

Source: Internet
Author: User

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

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.