标签:
50%的数据N<=10^3。
100%的数据N<=10^6。
n个点组成的无根树的情况有n^(n-2)个 @czl学霸求证明
还有打架的顺序有(n-1)!中
1 #include <bits/stdc++.h> 2 using namespace std; 3 const int MOD = 9999991; 4 int main() 5 { 6 int n; 7 long long ans = 1; 8 cin >> n; 9 for(int i = 1; i <= n - 2; i++) 10 ans = ans * n % MOD; 11 for(int i = 1; i <= n - 1; i++) 12 ans = ans * i % MOD; 13 cout << ans << endl; 14 return 0; 15 }
标签:
原文地址:http://www.cnblogs.com/CtrlCV/p/5351265.html