Submission #942851

#TimeUsernameProblemLanguageResultExecution timeMemory
942851vjudge1Fibonacci representations (CEOI18_fib)C++17
0 / 100
494 ms92852 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; int f[20]; 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<=15;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<=15;j++){ for(int k=a[i];k>=f[j];k--){ dp[k]+=dp[k-f[j]]; } } 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...