You are on page 1of 1

1.

We declare a variable a[n] and n=5


2. Now i=1, i<n, i=i+1, when we know that i={1,2,3,4,5,}
3. And j=1,j<=I, j=j+1 when we know that j={1,2,3,4,5}
4. Therefore to get the values of a[n], we declare a variable k, where i<=k<=j
5. Where k=j-i+1, and print a[k], which gives us

a[1][1] a[1][2] a[1][3] a[1][4] a[1][5] - Space available for 1st month

a[2][2] a[2][3] a[2][4] a[2][5] - Space available for 2nd month

a[3][3] a[3][4] a[3][5] Space available for 3rd month

a[4][4] a[4][5] Space available for 4th month

a[5][5] - Space available for 5th month

The objective function will be

650(a[1][1] + a[2][2] + a[3][3] + a[4][4]) +

1000 (a[1][2] + a[2][3] + a[3][4] + a[4][5]) +

1350 (a[1][3] + a[2][4] + a[3][5]) +

1600 (a[1][4] + a[2][5]) +

1900 (a[1][5]))

Therefore the objective function and the output of a[k] will be a right angled triangle as a pattern,
but the solution for the problem is not found.

The working/proceedings of the algorithm here will be as follows according to the constraints

a[1][1] + a[1][2] + a[1][3] + a[1][4] + a[1][5] >= 30000

a[1][2] + a[1][3]+ a[1][4] + a[1][5] + a[2][2]+a[2][3] + a[2][4] +a[2][5] >= 20000

a[1][3] + a[1][4] + a[1][5] + a[2][3] + a[2][4] + a[2][5] + a[3][3] + a[3][4] + a[3][5] >= 40000

a[1][4] + a[1][5] + a[2][4] +a[2][5] + a[3][4] + a[3][5] +a[4][4] + a[4][5] >= 10000

a[1][5] + a[2][5] +a[3][5] +a[4][5] + a[5][5] >= 10000

You might also like