#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
vector<int> a(n);
for (int& i: a) cin >> i;
vector<int> fibs(15);
fibs[0] = 1;
fibs[1] = 2;
for (int i = 2; i<15; i++){
fibs[i] = fibs[i-1] + fibs[i-2];
}
vector<int> dp(15*fibs.back()+1, 0);
dp[0] = 1;
for (int i : fibs){
for (int j = dp.size()-1; j >= 0; j--){
if (j-i >= 0) dp[j] += dp[j-i];
}
}
int cur = 0;
for (int i = 0; i<n; i++){
cur += fibs[a[i]-1];
cout << dp[cur] << endl;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |