Submission #942854

#TimeUsernameProblemLanguageResultExecution timeMemory
942854vjudge1Fibonacci representations (CEOI18_fib)C++17
5 / 100
888 ms45308 KiB
#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 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...