package org.acm.graph;
/*http://acm.nyist.net/JudgeOnline/problem.php?pid=127*/
//就是求n个节点可以组成的生成树有多少棵,n的n-2次方
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Scanner;
public class graph_127 {
private static int n;
private static long count;
public static void main(String[] args) {
Scanner sc = new Scanner(new BufferedReader(new InputStreamReader(System.in)));
int T = sc.nextInt();
while (T-- > 0) {
n = sc.nextInt();
if (n == 2)
System.out.println(1);
else {
count = 1;
for (int i = 0; i < n - 2; i++) {
count *= n;
count %= 10003;
}
System.out.println(count);
}
}
sc.close();
}
}
NYOJ-127(图论)-题目------------------------------星际之门(一)
最新推荐文章于 2018-08-22 18:58:46 发布