Q) You are living in a country where the only currency available is 'a' and 'b'. You are a shopkeeper. When customers pay you, they pay the closest possible amount, either lesser or greater. i.e. If an item is priced 'p' and 'p+r' is the closest value >= p and payable using currency 'a' and 'b' and 'p-s' is the closest value <= p and payable using currency 'a' and 'b' Then the customer would pay 'p+r' if r < s or 'p-s' if r >= s
Now given an item which costs p, you are to find the lowest possible price 'q' for this item such that (q <= 'p+r') and you make maximum profit out of it. Note: All prices are integral values Your prototype should be : int profitablePrice(int p, int a, int b). --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/algogeeks -~----------~----~----~----~------~----~------~--~---