首页 > 其他 > 详细

NYOJ题目28大数阶乘

时间:2016-10-23 02:16:24      阅读:345      评论:0      收藏:0      [点我收藏+]

技术分享

-------------------------------------
祭出BigInteger

 

AC代码:

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

public class Main {

    public static void main(String[] args) {
        
        Scanner sc=new Scanner(System.in);
        
        int n=sc.nextInt();
        
        BigInteger ans=fac(n);
        System.out.println(ans);
        
    }
    
    
    public static BigInteger fac(int n){
        BigInteger res=BigInteger.valueOf(n);
        while(--n>1) res=res.multiply(BigInteger.valueOf(n));
        return res;
    }
}

 

题目来源: http://acm.nyist.net/JudgeOnline/problem.php?pid=28

NYOJ题目28大数阶乘

原文:http://www.cnblogs.com/cc11001100/p/5988821.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!