Actually This is a piece of question ,i am struggling in that part so i want help . 1. so the problem is you have two equations — **v=x*v1+y*v2**

— **x*s1+y*s2<=s**

you have the values of v1,v2,s1,s2,s all are fit in 32 bit integer .you have to maximize the value of v ?? Constraints : s1>=1,s2>=1,v1>=1,v2>=1,v>=1,s>=1,x>=0,y>=0 and s1,s2,v1,v2,x,y,v,s all are positive integer.

You don't give enough information.

signedorunsigneddata types? This is quite important.x,y) have to belong to? , , or or something else?.

Or in a similar fashion:

More readable, isn't it?

And a side note: I don't know how others think, but I think you should improve on your interpunction (sorry to say, but the writing style like yours usually discourages me from answering).

Now that you have updated the post with additional data, we can start thinking.

Let's say the number of tests given is small. In such applications we call

feasible solutionsthe solutions which satisfy all the constraints (in our case,s_{1}x+s_{2}y≤s,x≥ 0 andy≥ 0). When we draw it on the plane, we will easily see that the feasible solutions are the lattice points inside or on the boundary of the triangle with vertices (0, 0), and . We have to find the feasible solution for which the valuev_{1}x+v_{2}yis the biggest.We can use the following trick:

if , then for each feasible solution (

x,y) the inequality follows. Then we can take each possible nonnegative integerx-coordinate (), take the highest point with this coordinate (when we look at the objective function, it'll become obvious why we shouldn't care about lower points) and check if it isn't the best solution. In this case we have time.if , we do exactly the same, but with

y-coordinates and get time.if nothing above follows, then

s_{1},s_{2}are reasonably small (not bigger than ). Let's say that (x,y) is an optimal feasible solution. Now consider two solutions: (x-s_{2},y+s_{1}) and (x+s_{2},y-s_{1}).x-s_{2},y+s_{1}) is not worse than (x,y), we may want it not to be feasible. The value is not worse iffv_{1}(x-s_{2}) +v_{2}(y+s_{1}) ≥v_{1}x+v_{2}ywhich reduces tov_{2}s_{1}≥v_{1}s_{2}. Now I leave as a quick excercise proving that the new point won't be feasible iffx<s_{2}. It means that ifv_{2}s_{1}≥v_{1}s_{2}, then we have to check only thes_{2}firstx-coordinates using exactly the same method as above. It means we have running time.x+s_{2},y-s_{1}). It's not worse iffv_{2}s_{1}≤v_{1}s_{2}and not feasible iffy<s_{1}. We conclude that ifv_{2}s_{1}≤v_{1}s_{2}, we need only to check thes_{1}firsty-coordinates.In all four cases, we have total running time (if I'm correct).