Submission #483230

#TimeUsernameProblemLanguageResultExecution timeMemory
483230MonarchuwuFibonacci representations (CEOI18_fib)C++17
5 / 100
55 ms492 KiB
#include<iostream> #include<algorithm> using namespace std; typedef long long ll; int f[25]; int n, a[25]; // f[15] = 1e3, f[15] * 15 = 15e3 int X[15'000]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); f[1] = 1, f[2] = 2; for (int i = 3; i <= 20; ++i) f[i] = f[i - 1] + f[i - 2]; for (int mask = 1, sum; mask < (1 << 20); ++mask) { sum = 0; for (int i = 0; i < 20; ++i) if ((1 << i) & mask) sum += f[i + 1]; if (sum < 15'000) ++X[sum]; } cin >> n; for (int i = 1, prf(0); i <= n; ++i) { cin >> a[i]; prf += f[a[i]]; cout << X[prf] << '\n'; } } /** /\_/\ * (= ._.) * / >0 \>1 **/
#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...