IT常识
技术 Python PHP JavaScript IOS Android Java 数据库 资源 公众号 代码片段 github
  • IT常识
  • 技术

NYOJ题目28大数阶乘

Posted 2020-08-15

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了NYOJ题目28大数阶乘相关的知识,希望对你有一定的参考价值。

-------------------------------------
祭出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大数阶乘的主要内容,如果未能解决你的问题,请参考以下文章

NYOJ 题目56 阶乘式因式分解

题目1076:N的阶乘(大数乘法)

nyoj 56-阶乘因式分解(数学)

nyoj 84-阶乘的0 (规律题)

大数阶乘

nyoj-155-求高精度幂(java大数)

(c)2006-2024 SYSTEM All Rights Reserved IT常识