加入收藏 | 设为首页 | 会员中心 | 我要投稿 淮安站长网 (https://www.0517zz.cn/)- 运营、云管理、经验、智能边缘、云硬盘!
当前位置: 首页 > 大数据 > 正文

hdu1042 N!(大数)

发布时间:2021-01-19 03:52:40 所属栏目:大数据 来源:网络整理
导读:N! Time Limit: 10000/5000 MS (Java/Others)????Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 75069????Accepted Submission(s): 21870 Problem Description Given an integer N(0 ≤ N ≤ 10000),your task is to calculate N! ?

N!

Time Limit: 10000/5000 MS (Java/Others)????Memory Limit: 262144/262144 K (Java/Others)
Total Submission(s): 75069????Accepted Submission(s): 21870


Problem Description Given an integer N(0 ≤ N ≤ 10000),your task is to calculate N!
?


Input One N in one line,process to the end of file.
?


Output For each N,output N! in one line.
?


Sample Input
  
  
   
   1
2
3
  
  
?


Sample Output
  
  
   
   1
2
6
  
  
?


Author JGShining(极光炫影) ?


Recommend We have carefully selected several similar problems for you:?? 1715? 1047? 1063? 1753? 1316? ?


Statistic?|? Submit?|? Discuss | Note

java大法好~~~

import java.math.BigInteger;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		// TODO Auto-generated method stub
		Scanner sca=new Scanner(System.in);
		BigInteger res[]=new BigInteger[10000+10];
		res[0]=BigInteger.ONE;
		for(int i=1;i<10000+1;i++){
			res[i]=res[i-1].multiply(BigInteger.valueOf(i));
		}
		while(sca.hasNext()){
			int x=sca.nextInt();
			System.out.println(res[x]);
		}
	}

}

??

(编辑:淮安站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读