Submission #267146

#TimeUsernameProblemLanguageResultExecution timeMemory
267146peuchFibonacci representations (CEOI18_fib)C++17
0 / 100
1 ms416 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 1e2 + 10; int n; int v[MAXN]; int ans[MAXN]; int fib[MAXN]; void refreshFib(); void bt(int cur, int val); int main(){ bt(1, 0); scanf("%d", &n); int sum = 0; refreshFib(); for(int i = 1; i <= n; i++){ int aux; scanf("%d", &aux); sum += fib[aux]; printf("%d\n", ans[sum]); } } void refreshFib(){ fib[1] = 1; fib[0] = 1; for(int i = 2; i <= 12; i++) fib[i] = fib[i - 1] + fib[i - 2]; } void bt(int cur, int val){ refreshFib(); if(cur > 12){ ans[val]++; return; } bt(cur + 1, val + fib[cur]); bt(cur + 1, val); }

Compilation message (stderr)

fib.cpp: In function 'int main()':
fib.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   17 |  scanf("%d", &n);
      |  ~~~~~^~~~~~~~~~
fib.cpp:22:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   22 |   scanf("%d", &aux);
      |   ~~~~~^~~~~~~~~~~~
#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...