⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 2836862_ac_250ms_5188k.java

📁 北大大牛代码 1240道题的原代码 超级权威
💻 JAVA
字号:
import java.util.*;
import java.math.*;

public class Main {
    
    static BigInteger one = new BigInteger ("1");
    static BigInteger two = new BigInteger ("2");
    
    public static BigInteger fact(BigInteger n)
    {
        if(n.intValue()==1)
            return n;
        else
            return n.multiply(fact(n.subtract(one)));
    }
  
    public static void main(String[] args) {
       
        Scanner cin = new Scanner (System.in);
        BigInteger n;
        
        while(true)
        {
            n = cin.nextBigInteger();
            if (n.intValue()==-1)
                break;
            System.out.println("N="+n+":");
            n = n.subtract(one);
            n = fact(n);
            n = n.multiply(two);
            System.out.println(n);
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -