回覆列表
  • 1 # 唯我曼聯

    package com;

    import java.math.BigInteger;

    public class Marik

    {

    public static BigInteger fac(long n)

    {

    if(n == 0 || n == 1)

    {

    return BigInteger.ONE;

    }

    else if(n > 1)

    {

    return fac(n - 1).multiply(BigInteger.valueOf(n));

    }

    else

    {

    return BigInteger.ZERO;

    }

    }

    public static void main(String[] args)

    {

    BigInteger sum = BigInteger.ZERO;

    long n = 1;

    BigInteger b9999 = BigInteger.valueOf(9999);

    while(sum.compareTo(b9999) <= 0)

    {

    sum = sum.add(fac(n));

    n++;

    }

    System.out.println(n);

    }

    }

  • 中秋節和大豐收的關聯?
  • 《我在未來等你》大概什麼時候會播出?值得期待嗎?