Nikit has to give a short contest of duration "n" minutes. The contest is divided into 2 sections-Easy and Hard. x and y marks will be awarded per problem for Easy and Hard respectively. Assume that he will take p minutes to solve an Easy problem and q minutes to solve a Hard problem successfully.
There are a and b number of Easy and  Hard problems respectively. Calculate how many problems of a particular section should he perform to get the maximum score in time.
Note: Assume he will always try to solve the easiest problem.
 
Example 1:
Input: n = 180, x = 2, y = 5, a = 4
b = 6,p = 20, q = 40
Output: 1 4
Explanation: Maximum marks get scored 
when he solves 1 easy and 4 hard problems.
Example 2:
Input: n = 50, x = 5, y = 10, a = 5 
b = 3, p = 10, q = 20
Output: 5 0
Explanation : Maximum marks gets scored 
when he solves 5 easy problems or 1 easy 
and 2 hard problems or 3 easy and 1 hard 
problem. But he always try to solve the 
easiest problem therefore solves 5 easy 
problems.
 
Your Task:
You don't need to read or print anything. Your task is to complete the function maximumScore() which takes n, x, y, a, b, p, and q as input parameter and returns a list which contains the total number of easy problems and hard problems required to solve to get the maximum score.
 
Expected Time Complexity: O(a * b)
Expected Space Complexity: O(1)
 
Constraints:
1 <= n <= 1000
1 <= x < y <= 100
1 <= a, b <= 100
1 <= p < q <= 100

Difficulty: EASY
Tags: Mathematics
Expected Time Complexity: O(a * b)
Expected Auxiliary Space: O(1)

Starter code:
#User function Template for python3



class Solution:

	def maximumScore(self, n, x, y, a, b, p, q):

		# Code here

Solutions:
class Solution:

	def maximumScore(self, n, x, y, a, b, p, q):
		max = 0
		lst = [0, 0]
		for i in range(0, a + 1):
			for j in range(0, b + 1):
				if i * x + j * y > max and i * p + j * q <= n:
					max = i * x + j * y
					lst[0] = i
					lst[1] = j
				elif i * x + j * y == max and i * p + j * q <= n and (lst[0] < i):
					lst[0] = i
					lst[1] = j
				else:
					pass
		return lst


class Solution:

	def maximumScore(self, n, x, y, a, b, p, q):
		m = x
		c = d = 0
		for i in range(0, a + 1):
			for j in range(0, b + 1):
				if p * i + q * j <= n:
					if x * i + y * j >= m:
						m = x * i + y * j
						c = i
						d = j
		return (c, d)


class Solution:

	def maximumScore(self, n, x, y, a, b, p, q):
		max_easy = min(n // p, a)
		max_hard = min((n - max_easy * p) // q, b)
		max_score = max_easy * x + max_hard * y
		for i in range(max_easy + 1):
			j = min((n - i * p) // q, b)
			score = i * x + j * y
			if score > max_score:
				max_score = score
				max_easy = i
				max_hard = j
		return [max_easy, max_hard]


class Solution:

	def maximumScore(self, n, x, y, a, b, p, q):
		max = 0
		easy = 0
		hard = 0
		for i in range(a, -1, -1):
			for j in range(b + 1):
				if p * i + q * j <= n:
					if x * i + y * j > max:
						easy = i
						hard = j
						max = x * i + y * j
		return [easy, hard]


class Solution:

	def maximumScore(self, n, x, y, a, b, p, q):
		a = [n, x, y, a, b, p, q]
		h = 0
		k = []
		for i in range(a[3], -1, -1):
			for j in range(a[4], -1, -1):
				c = a[5] * i + a[6] * j
				if c <= a[0]:
					l = i * a[1] + j * a[2]
					if h <= l:
						k.append([i, j, l])
						h = l
		l = 0
		p = []
		for i in k:
			if i[2] == l:
				p.append(i)
				l = i[2]
			elif i[2] > l:
				p = [i]
				l = i[2]
		l = max(p)
		l.pop()
		return l
if __name__ == '__main__':
	T = int(input())
	for i in range(T):
		n = int(input())
		(x, y) = input().split()
		(a, b) = input().split()
		(p, q) = input().split()
		x = int(x)
		y = int(y)
		a = int(a)
		b = int(b)
		p = int(p)
		q = int(q)
		ob = Solution()
		ans = ob.maximumScore(n, x, y, a, b, p, q)
		for _ in ans:
			print(_, end=' ')
		print()