// aarifshuvo ``CSEJU #include <bits/stdc++.h> #define ll long long #define SZ(x) ((int)(x).size()) #define scl(x) scanf("%lld", &x) #define scll(x,y) scanf("%lld %lld", &x, &y) #define ALL(x) (x).begin(),(x).end() #define REP(i,n) for(int i=0;i<n;i++) #define REV(i,n) for(int i=n-1;i>=0;i--) #define FOR(i,a,b) for(int i=a;i<=b;i++) #define pri(a) cout<<a<<endl using namespace std; ll a, b, c, d, e, f; ll dp[12000]; ll fn( int n ) { if( n == 0 ) return a; if( n == 1 ) return b; if( n == 2 ) return c; if( n == 3 ) return d; if( n == 4 ) return e; if( n == 5 ) return f; if(dp[n]!=-1) return dp[n]; return dp[n] = ( fn(n-1) + fn(n-2) + fn(n-3) + fn(n-4) + fn(n-5) + fn(n-6) )%10000007; } int main() { ll n, caseno = 0, cases; scanf("%lld", &cases); while( cases-- ) { memset(dp,-1,sizeof dp); scanf("%lld %lld %lld %lld %lld %lld %lld", &a, &b, &c, &d, &e, &f, &n); printf("Case %lld: %lld\n", ++caseno, fn(n) % 10000007); } return 0; }
~Be glad of life because it gives you the chance to love and to work and to play and to look at the stars.~
Thursday, June 1, 2017
LightOJ 1006 Hex-a-bonacci
Subscribe to:
Post Comments (Atom)
Lucky Club Casino Site - Lucky Club
ReplyDeleteGet up to £100 with Lucky Club's exclusive offer, plus a 30 free spins plus 50 extra luckyclub spins when you join now. ✓ Register now! ✓ 30-day expiry.