mind

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • coolbikash89
    New Member
    • Aug 2008
    • 3

    mind

    we have coins of a, b, c. and the shopkeaper also have the same. to purchase some thng we have to pay x rupees to shop keaper, he can also return coins to us. Write a program to find the minimum no. of coins required for transaction.
  • newb16
    Contributor
    • Jul 2008
    • 687

    #2
    Originally posted by coolbikash89
    Write a program to find the minimum no. of coins required for transaction.
    What for? i.e any ideas why one should do it?

    Comment

    • JosAH
      Recognized Expert MVP
      • Mar 2007
      • 11453

      #3
      Originally posted by coolbikash89
      we have coins of a, b, c. and the shopkeaper also have the same. to purchase some thng we have to pay x rupees to shop keaper, he can also return coins to us. Write a program to find the minimum no. of coins required for transaction.
      That's a simple IP problem (Integer Programming); let n1, n2, n3 be the number
      of coins of value a, b and c paid by the customer and m1, m2, n3 be the number
      of coins returned by the shopkeeper. The single constraint is:

      n1*a + n2*b + n3*c - m1*a - m2*b - m3*c == x

      The cost function is n1+n2+n3+m1+m2+ m3 which should be minimized.

      kind regards,

      Jos

      Comment

      • coolbikash89
        New Member
        • Aug 2008
        • 3

        #4
        write a c program for that

        Comment

        • coolbikash89
          New Member
          • Aug 2008
          • 3

          #5
          Originally posted by JosAH
          That's a simple IP problem (Integer Programming); let n1, n2, n3 be the number
          of coins of value a, b and c paid by the customer and m1, m2, n3 be the number
          of coins returned by the shopkeeper. The single constraint is:

          n1*a + n2*b + n3*c - m1*a - m2*b - m3*c == x

          The cost function is n1+n2+n3+m1+m2+ m3 which should be minimized.

          kind regards,

          Jos
          we want a c program for that

          Comment

          • Banfa
            Recognized Expert Expert
            • Feb 2006
            • 9067

            #6
            Originally posted by coolbikash89
            we want a c program for that
            Excellent, when you have written it please feel free to post here with any problems that you are having with it.

            Comment

            • JosAH
              Recognized Expert MVP
              • Mar 2007
              • 11453

              #7
              Originally posted by coolbikash89
              write a c program for that
              Cplex (by ILog) is written in C; I believe they have a student license for their
              Integer Linear Programming solver module. Good luck.

              kind regards,

              Jos

              Comment

              Working...