Advertisement
erfanul007

LOJ 1006

Apr 14th, 2021
723
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.39 KB | None | 0 0
  1. #include<stdio.h>
  2. int main() {
  3.     long long int a[10007],n, j = 0,k, cases;
  4.     scanf("%lld", &cases);
  5.     while( cases-- ) {
  6.         scanf("%lld %lld %lld %lld %lld %lld %lld", &a[0], &a[1], &a[2], &a[3], &a[4], &a[5], &n);
  7.         for(k=6;k<=n;k++)
  8.             a[k]=(a[k-1]+a[k-2]+a[k-3]+a[k-4]+a[k-5]+a[k-6])%10000007;
  9.         printf("Case %lld: %lld\n", ++j, a[n]%10000007);
  10.     }
  11.     return 0;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement