#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define popcount __builtin_popcountll
#define all(a) (a).begin(), (a).end()
using namespace std;
using namespace __gnu_pbds;
template<typename T> using ordered_set = tree<T, null_type, less<>, rb_tree_tag, tree_order_statistics_node_update>;
const int A = 987*100, MOD = 1e9+7;
int f[15], dp[A + 1];
void add(int x) {
for (int j = A; j >= x; j--) {
dp[j] += dp[j-x];
if (dp[j] >= MOD) dp[j] -= MOD;
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
dp[0] = 1;
f[0] = 1;
f[1] = 2;
for (int i = 2; i < 15; i++)
f[i] = f[i-1] + f[i-2];
for (int x : f)
add(x);
int n; cin >> n;
int sum = 0;
while (n--) {
int x; cin >> x;
sum += f[--x];
cout << dp[sum] << "\n";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |