Submission #267155

#TimeUsernameProblemLanguageResultExecution timeMemory
267155peuchFibonacci representations (CEOI18_fib)C++17
0 / 100
3 ms512 KiB
#include<bits/stdc++.h> using namespace std; const int MAXN = 20; int n; int f[MAXN]; int sum; int ans[2000000]; int main(){ 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 < (1<<15); i++){ int aux = 0; for(int k = 0; k < 15; k++) if(i & (1<<k)) aux += f[k + 1]; ans[aux]++; } scanf("%d", &n); for(int i = 1; i <= n; i++){ int aux; scanf("%d", &aux); sum += f[aux]; printf("%d\n", ans[sum]); } }

Compilation message (stderr)

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