求求求!java

P2181 对角线

用long不够 要用BigInteger
by yehaixin @ 2022-03-22 20:22:45


```java import java.math.BigInteger; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); BigInteger n = scanner.nextBigInteger(); BigInteger two = new BigInteger("2"); BigInteger three = new BigInteger("3"); BigInteger four = new BigInteger("4"); BigInteger n_1 = n.subtract(BigInteger.ONE); BigInteger n_2 = n.subtract(two); BigInteger n_3 = n.subtract(three); System.out.println(n.multiply(n_1).divide(two).multiply(n_2).divide(three).multiply(n_3).divide(four)); } } ```
by magpieeeee @ 2022-04-11 12:59:22


|