BZOJ1430 小猴打架

娱乐向题目

ans = (n - 1) ! * n ^ (n - 2)...没了

 1 /**************************************************************
 2     Problem: 1430
 3     User: rausen
 4     Language: C++
 5     Result: Accepted
 6     Time:188 ms
 7     Memory:804 kb
 8 ****************************************************************/
 9  
10 #include <cstdio>
11  
12 using namespace std;
13 const int mod = 9999991;
14  
15 int i, n;
16 long long x = 1;
17  
18 int main() {
19     scanf("%d
", &n);
20     for (i = 1; i < n - 1; ++i)
21         (x *= n) %= mod;
22     for (i = 1; i < n; ++i)
23         (x *= i) %= mod;
24     printf("%lld
", x);
25     return 0;
26 }
View Code
By Xs酱~ 转载请说明 博客地址:http://www.cnblogs.com/rausen
原文地址:https://www.cnblogs.com/rausen/p/4132929.html