All decomposition of an integer

xiaoxiao2021-03-06  57

Set M.N is natural number, m can be represented as some natural number of non-Ne Nature, f (m, n) is the number of this representation. Example f (5, 3) = 5, there are five ways: 3 2, 3 1 1, 2 2 1, 2 1 1 1, 1 1 1 1 1. Reclassification method F (m, n).

Asking all the output, I didn't think about it for a long time, thinking that the recursion can not solve it, 9cbsgalois_godel () is solved.

#include #include #include Using Namespace std; int ANS [1000]; void fun (int M, int N, int LEN) {INT i; if (! m) {cout << ANS [0]; for (i = 1; i = 1; I -) {ANS [LEN] = I; FUN (MI, I, LEN 1);}}

INT main () {Int m, n; while (cin >> m >> n) fun (m, n, 0); return 0;}

转载请注明原文地址:https://www.9cbs.com/read-112902.html

New Post(0)