Submission #942722

#TimeUsernameProblemLanguageResultExecution timeMemory
942722vjudge1Fibonacci representations (CEOI18_fib)C++17
0 / 100
1 ms640 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() #define size(x) (int)x.size() template<class S, class T> bool chmin(S &a, const T &b) { return a > b ? (a = b) == b : false; } template<class S, class T> bool chmax(S &a, const T &b) { return a < b ? (a = b) == b : false; } const int mod = 1e9 + 7; signed main() { cin.tie(nullptr)->sync_with_stdio(false); int n; cin >> n; int a[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; } int f[68]; f[0] = 1, f[1] = 2; for (int i = 2; i < 68; ++i) { f[i] = f[i - 1] + f[i - 2]; } int dp[10000]; memset(dp, 0, sizeof(dp)); dp[0] = 1; for (int i = 0; i < 68; ++i) { for (int j = 9999; j - f[i] >= 0; --j) { dp[j] += dp[j - f[i]]; dp[j] %= mod; } } int pref = 0; for (int i = 0; i < n; ++i) { pref += f[a[i] - 1]; cout << dp[pref] << '\n'; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...