This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int mod=1e9+7;
int f[30];
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n;
cin>>n;
vector <int> a(n);
f[1]=1;f[2]=2;
for(int i=3;i<=20;i++)f[i]=f[i-1]+f[i-2];
for(int i=0;i<n;i++){
cin>>a[i];
a[i]=f[a[i]];
if(i-1>=0)a[i]+=a[i-1];
}
for(int i=0;i<n;i++){
vector <int> dp(a[i]+1);
dp[0]=1;
for(int j=1;j<=20;j++){
for(int k=a[i];k>=f[j];k--){
dp[k]+=dp[k-f[j]];
dp[k]%=mod;
}
}
cout<<dp[a[i]]<<"\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... |