-
Notifications
You must be signed in to change notification settings - Fork 0
/
Hex_a_bonacci.cpp
83 lines (67 loc) · 1.33 KB
/
Hex_a_bonacci.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <bits/stdc++.h>
using namespace std;
#define ll long long
// Ashfak Hossain Evan, CSE, American International University-Bangladesh (AIUB)
ll t, a, b, c, d, e, f, n;
ll arr[10005];
int fn(int n)
{
for (int i = 0; i <= n; i++)
{
if (i == 0)
{
arr[i] = a;
continue;
}
if (i == 1)
{
arr[i] = b;
continue;
}
if (i == 2)
{
arr[i] = c;
continue;
}
if (i == 3)
{
arr[i] = d;
continue;
}
if (i == 4)
{
arr[i] = e;
continue;
}
if (i == 5)
{
arr[i] = f;
continue;
}
arr[i] = arr[i - 1] + arr[i - 2] + arr[i - 3] + arr[i - 4] + arr[i - 5] + arr[i - 6];
arr[i] = arr[i] % 10000007;
}
return arr[n];
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL), cout.tie(NULL);
// Code Start From Here
ll ans;
cin >> t;
for (ll i = 1; i <= t; i++)
{
cin >> a;
cin >> b;
cin >> c;
cin >> d;
cin >> e;
cin >> f;
cin >> n;
ans = fn(n);
ans %= 10000007;
cout << "Case " << i << ": " << ans << endl;
}
return 0;
}