1057 N的阶乘
基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题
输入N求N的阶乘的准确值。
Input
输入N(1 <= N <= 10000)
Output
输出N的阶乘
Input示例
5
Output示例
120
思路:java暴力
代码:
//package javaBigInt;
import java.math.BigInteger;
import java.util.Scanner;
public class theFactor_of_N {
public static void main(String[] args){
Scanner cin=new Scanner(System.in);
int n=cin.nextInt();
int t=n;
BigInteger res=new BigInteger("1");
for(int i=2;i<=n;i++ ){
String tp=""+i;
BigInteger res1=new BigInteger(tp);
res=res.multiply(res1);
}
System.out.println(res);
}
}