Q1. Little Pony owns a shipment company. There is a priority value and a weight associate with each package. To ship in a single batch with priorities P1, P2,....., Pk they charge
Summation (i = 1 to k) P(i) * (K+1-i)
There and N packages in queue to be shipped.
A[i][0] denotes weight of package.
A[i][1] denotes priority of package
I'th package cannot ship before I-1'th package.
Maximum weight of packages together in 1 batch is limited by a given value B.
Multiple batches can be used to ship package.
Find the maximum amount that can be charged.
Note:-
Priorities can be negative.
B >= A[i][0] always so each package can be shipped.
Ans to be given as module 10^9+7.
Q2. Given two non-negative integers A and B, both of which have to be made = to 0.
Cost = 2
if A,B both replaced with floor (greatest integer function) of the square root of product of A.B
Cost = 1
if either A or B divided by 2.
Find the minimum cost to make both A and B equal to 0.
Any tips on how to solve these ?