hdu-1042-n! (Java Dafa good && hdu large number of water problems)

Source: Internet
Author: User

N!Time limit:10000/5000 MS (java/others) Memory limit:262144/262144 K (java/others)
Total submission (s): 64256 Accepted Submission (s): 18286


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 Input
123

Sample Output
126

Authorjgshining (Aurora Dazzle)
Recommendwe carefully selected several similar problems for you:1715 1047 1063 1753 1316

Java Dafa Good, back C to protect peace .... Joking, Java and C each have their advantages and disadvantages, indispensable! I will not large number of templates, the use of BigInteger, HDU large number of water problems do not explain!
Import java.io.*;import java.math.biginteger;import java.util.*;p ublic class main{public static void Main (string[] args {Scanner input = new Scanner (system.in); while (Input.hasnext ()) {int n = input.nextint (); BigInteger p = biginteger.one;for (int i=1;i<=n;i++) {p=p.multiply (biginteger.valueof (i));} SYSTEM.OUT.PRINTLN (P);}}




hdu-1042-n! (Java Dafa good && hdu large number of water problems)

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.