题目
分析
- 画画图可以发现首先必须割五边形中的一条,然后n边形中也必须割一条
- so 4*5^n-1*n
代码
1 #include<cstdio>
2 #include<cstdlib>
3 #include<cstring>
4 #include<iostream>
5 #include<algorithm>
6 using namespace std;
7
8 const int mod=2007;
9 int qk(int x,int t)
10 {
11 int ret=1;
12 while (t)
13 {
14 if (t&1) ret=(ret*x)%mod;
15 x=(x*x)%mod;t>>=1;
16 }return ret;
17 }
18 int main()
19 {
20 freopen("count.in","r",stdin);
21 freopen("count.out","w",stdout);
22 int n,ans,T;
23 scanf("%d",&T);
24 while (T--)
25 {
26 scanf("%d",&n);
27 ans=(((4*qk(5,n-1))%mod)*n)%mod;
28 printf("%d
",ans);
29 }return 0;
30 }