Need help for a fibonacci problem

Правка en2, от backupkid, 2026-05-24 19:04:50

Hello reader!

I came across this problem and I'm not sure how to approach it. Any hints would be appreciated!

Problem:

The Fibonacci sequence is defined as F(0) = 1, F(1) = 1, F(n) = F(n-1) + F(n-2). So: 1, 1, 2, 3, 5, 8, 13, 21, 34, ...

Given N, count the number of ways to write N as a product of Fibonacci numbers, where each factor is > 1. Order does not matter (2×4 and 4×2 are the same representation).

Example: Input: 4 2 7 40 64 Output: 1 0 2 3

Constraints: - T ≤ 50 test cases - N can be up to 10^18

I have no idea where to start. How do you approach this kind of problem?

Thank you!

Теги fibonacci

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский backupkid 2026-05-24 19:04:50 12 Tiny change: '\nHello Codeforces!\n\nI cam' -> 'Hello reader!\n\nI cam'
en1 Английский backupkid 2026-05-24 19:00:22 681 Initial revision (published)