娱乐向题目

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", &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\n", x);
25     return 0;
26 }
View Code

 

posted on 2014-11-30 11:54  Xs酱~  阅读(137)  评论(0编辑  收藏  举报