total identical apples into three numbered baskets. Each basket holds at most cap apples, a basket may stay empty, and every apple must be placed.
How many ways are there? Two ways differ if some basket gets a different number of apples.total=4, cap=2 → 6
The options are (2,2,0), (2,0,2), (0,2,2), (2,1,1), (1,2,1), (1,1,2), six ways.
total=2, cap=5 → 6
The cap never matters here: (2,0,0), (0,2,0), (0,0,2), (1,1,0), (1,0,1), (0,1,1).
total=10, cap=3 → 0
total ≤ 10⁸cap ≤ 10⁸total=4, cap=2
6
Run checks the first 3 tests in your browser. Submit checks all 77 tests on the server, hidden ones included.