Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t,cs=1;
- cin>>t;
- while(t--)
- {
- int a,b,c,d,e,f,n;
- cin>>a>>b>>c>>d>>e>>f>>n;
- int dp[n+1];
- memset(dp,-1,sizeof(dp));
- dp[0]=a;
- dp[1]=b;
- dp[2]=c;
- dp[3]=d;
- dp[4]=e;
- dp[5]=f;
- for(int 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;
- }
- printf("Case %d: ",cs++);
- cout<<dp[n] % 10000007<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement