http://acm.hdu.edu.cn/showproblem.php?pid=5642

 

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<cstring>
 4 #include<cmath>
 5 #include<algorithm>
 6 using namespace std;
 7 
 8 int main()
 9 {
10     int n,t;
11     long long a[4],ans,cut1,cut2;
12     cin>>t;
13     while (t--)
14     {
15         cin>>n;
16         if (n<=0)
17         {
18             cout<<"0"<<endl;
19             continue;
20         }
21         if (n==1)
22         {
23             cout<<"26"<<endl;
24             continue;
25         }
26         a[0]=26*25;
27         a[1]=26;
28         a[2]=0;
29         for (int i=3;i<=n;i++)
30         {
31             cut1=a[0];
32             cut2=a[1];
33             a[0]=((a[0]+a[1]+a[2])*25)%1000000007;
34             a[1]=cut1;
35             a[2]=cut2;
36 
37         }
38         ans=(a[1]+a[2]+a[0])%1000000007;
39         cout<<ans<<endl;
40     }
41     return 0;
42 }

 

posted on 2016-03-13 14:17  pb2016  阅读(161)  评论(0编辑  收藏  举报