Tuesday, July 28, 2015

1006 - Hex-a-bonacci

#include<iostream>
#include<stdio.h>
using namespace std;
 
int main()
{
    long long int a,b,c,d,e,f,n,fn[10050],caseno=1,cases;
    scanf("%lld",&cases);
    while(cases--)
    {
        scanf("%lld%lld%lld%lld%lld%lld%lld",&fn[0],&fn[1],&fn[2],&fn[3],&fn[4],&fn[5],&n);
        for(int i=6; i<=n; i++)
            fn[i]=(fn[i-1]+fn[i-2]+fn[i-3]+fn[i-4]+fn[i-5]+fn[i-6])%10000007;
        printf("Case %lld: %lld\n",caseno++,fn[n]%10000007);
    }
 
    return 0;
}

No comments:

Post a Comment

Triathlon

Triathlon - CodeChef # include < bits/stdc++.h > using namespace std ; # define fi first # define se second # define mp ...