Skip to content

Instantly share code, notes, and snippets.

@yao2030
Created June 21, 2014 03:59
Show Gist options
  • Save yao2030/2c084e6ee844a3ac6234 to your computer and use it in GitHub Desktop.
Save yao2030/2c084e6ee844a3ac6234 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
int Count(int m, int n) {
if (n == 0 || n == 1) {
return 1;
}
if (n > m) {
return Count(m, m);
}
return Count(m, n - 1) + Count(m - n, n);
}
int main(void) {
int m, n;
cin >> m >> n;
cout << Count(m, n);
return 0;
}
@yao2030
Copy link
Author

yao2030 commented Jun 21, 2014

put m apples in n plates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment