public static int getCount (int apple, int plate, int max) {

		if (plate == 1 && apple > max) {
			return 0;
		}

		if (apple == 0 || plate == 1) {
			return 1;
		}

		int count = 0;
		for (int i=Math.min(apple, max); i>=0; i--) {
			int currentCount = getCount(apple-i, plate-1, i);
			if (currentCount == 0) {
				break;
			}
		 	count = count + currentCount;
		}
		return count;
	}