Created
June 2, 2018 20:59
-
-
Save Badhansen/0e74650f828142cc1effa4338956e4c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <cstdio> | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
ll a, b, c, d, e, f; | |
ll dp[10008]; | |
ll charom(ll a, ll b, ll c, ll d, ll e, ll f, ll n) | |
{ | |
ll i; | |
dp[0]=a; | |
dp[1]=b; | |
dp[2]=c; | |
dp[3]=d; | |
dp[4]=e; | |
dp[5]=f; | |
for (i=6;i<=n;i++){ | |
dp[i]=(dp[i-1]+dp[i-2]+dp[i-3]+dp[i-4]+dp[i-5]+dp[i-6])%10000007; | |
} | |
return dp[n]; | |
} | |
int main() { | |
ll n, caseno=0, cases; | |
scanf("%lld", &cases); | |
while(cases--) { | |
scanf("%lld %lld %lld %lld %lld %lld %lld", &a, &b, &c, &d, &e, &f, &n); | |
ll ck=charom(a, b, c, d, e, f, n)%10000007; | |
printf("Case %lld: %lld\n", ++caseno, ck); | |
} | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment