Submission #972072

#TimeUsernameProblemLanguageResultExecution timeMemory
972072Charizard2021Fibonacci representations (CEOI18_fib)C++17
5 / 100
125 ms3216 KiB
#include<bits/stdc++.h> using namespace std; int main(){ int fibonacci[21]; fibonacci[0] = 1; fibonacci[1] = 1; for(int i = 2; i <= 20; i++) fibonacci[i] = fibonacci[i - 1] + fibonacci[i - 2]; map<int, int> mp; for(int i = 0; i < (1 << 20); i++){ int sum= 0; for(int j =0 ; j < 20; j++){ if(i & (1 << j)){ sum += fibonacci[1 + j]; } } mp[sum]++; } int curSum = 0; int n; cin >> n; for(int i = 0; i < n; i++){ int x; cin >> x; curSum += fibonacci[x]; cout << mp[curSum] << " "; } cout << "\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...