Question link: Click the open link
Question:
Given a number n
Ask to split this number into multiple different ononacci numbers
How many split methods are there?
# Include <stdio. h> # include <string. h> # include <iostream> # include <algorithm> # include <math. h> # include <set> # include <queue> # include <vector> # include <map> using namespace STD; # define ll _ int64 # define n 90ll n, m; ll f [N], DP [N] [2]; // DP [I] [0] indicates the number of DP [I] [1] That does not split the subscript into I. The number vector <int> G that splits the subscript into I; int main () {ll I, j, U, V, T; CIN> T; F [1] = 1; F [2] = 2; for (I = 3; I <n; I ++) f [I] = f [I-1] + F [I-2]; while (t --) {G. clear (); CIN> N; for (I = N-1; I --) {If (F [I] <= N) {G. push_back (I); N-= f [I] ;}} reverse (G. begin (), G. end (); DP [0] [0] = 1; DP [0] [1] = (G [0]-1)> 1; for (ll I = 1; I <G. size (); I ++) {DP [I] [0] = DP [I-1] [0] + dp [I-1] [1]; DP [I] [1] = DP [I-1] [0] * (g [I]-G [I-1]-1)/2) + dp [I-1] [1] * (g [I]-G [I-1])/2);} cout <DP [G. size ()-1] [0] + dp [G. size ()-1] [1] <Endl;} return 0 ;}