dzungchaos

C++ "Chia phần thưởng"

Nov 6th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.24 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. long PART(int m, int n){
  5.     if (n == 0) return 0;
  6.     if (m == 0) return 1;
  7.     if (m < n) return PART(m, m);
  8.     return PART(m, n - 1) + PART(m - n, n);
  9. }
  10.  
  11. int main(){
  12.     cout << PART(5,3) << endl;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment