hiho week 226 register

Ended

Participants:135

Verdict:Accepted
Score:100 / 100
Submitted:2018-10-28 17:47:52

Lang:G++

Edit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <stdio.h>
typedef long long ll;
const ll mod=1000000007;
ll max(ll a,ll b){ return a>b?a:b; }
ll fastpower(ll a,ll b)     
{     
    ll res=1;     
    ll temp=a;     
    while(b){    
       if(b&1) res=res*temp%mod;     
       temp=temp*temp%mod;     
       b>>=1;  
    }
    return res;     
}
void solve(){
    int n;
    scanf("%d",&n);
    ll dp[16];
    //7
    for(int i=0;i<7;i++) dp[i]=i;
    for(int i=7;i<16;i++){
        dp[i]=0;
        //K
        for(int k=i-3;k>0;k--) dp[i]=max(dp[i],dp[i-2-k]*(k+1)%mod); 
    }
    if(n<16) printf("%lld",dp[n]);
    else{
        int x=(n-11)%5+11;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX