출처 : https://leetcode.com/problems/distribute-candies-among-children-i/
You are given two positive integers n and limit.
Return the total number of ways to distribute n candies among 3 children such that no child gets more than limit candies.

class Solution {
public int distributeCandies(int n, int limit) {
int count = 0;
for (int a = 0; a <= limit; a++) {
int total = n;
total -= a;
for (int b = 0; b <= limit; b++) {
total -= b;
for (int c = 0; c <= limit; c++) {
total -= c;
if (total == 0) {
count++;
}
total += c;
}
total += b;
}
}
return count;
}
}