private int cutRod(int n)
	{
		if (n == 0) // base case
			return r[n];

		// memoized result
		if (r[n] != Integer.MIN_VALUE)
			return r[n];

		int max = Integer.MIN_VALUE;
		for (int i = 1; i <= n; i++)
		{
			int t = cutRod(n - i);
			if ( p[i] + t > max) {
				max = p[i] + t;
				cuts[n] = new String(i + " " + cuts[n - i]);
			}
		}
		r[n] = max;
		return r[n];
	}