Advertisement
Guest User

Untitled

a guest
Apr 24th, 2017
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5. int t,cs=1;
  6. cin>>t;
  7. while(t--)
  8. {
  9. int a,b,c,d,e,f,n;
  10. cin>>a>>b>>c>>d>>e>>f>>n;
  11. int dp[n+1];
  12. memset(dp,-1,sizeof(dp));
  13. dp[0]=a;
  14. dp[1]=b;
  15. dp[2]=c;
  16. dp[3]=d;
  17. dp[4]=e;
  18. dp[5]=f;
  19. for(int i=6; i<=n; i++)
  20. {
  21. dp[i]=(dp[i-1]+dp[i-2]+dp[i-3]+dp[i-4]+dp[i-5]+dp[i-6]) % 10000007;
  22. }
  23. printf("Case %d: ",cs++);
  24. cout<<dp[n] % 10000007<<endl;
  25. }
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement