CWAY - Đếm số đường đi trên đồ thị đầy đủ

Tác giả: khuc_tuan

Ngôn ngữ: Java

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

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		BigInteger cur = BigInteger.ONE;
		for (int i = 3; i <= n; ++i)
			cur = cur.multiply(BigInteger.valueOf(i - 2)).add(BigInteger.ONE);
		System.out.println(cur);
	}
}

Download