Codeforces и Polygon могут быть недоступны в период с 23 мая, 7:00 (МСК) по 23 мая, 11:00 (МСК) в связи с проведением технических работ. ×

Блог пользователя viper1234

Автор viper1234, история, 18 месяцев назад, По-английски

Can someone help me with this problem, any help will be appreciated.

Problem Statement: Bob wants to purchase N pens and so has prepared a list of shops that sell the pens. Each shop charges a different price per pen and has a limited quantity available in stock. Along with the price of the pen, each shop charges fixed delivery fees irrespective of how many pens are bought. Write a program to help Bob get the N pens as cheaply as possible.

Input Format: The first input line has two integers: N, the number of pens Bob needs, and S, the number of shops. Next, S lines have 3 integers, Q, P, and D, where Q is the stock of pens available at the shop, P is the price per pen and D is the delivery fee.

Output Format: A single line of output has an integer, which is the minimum amount Bob has to spend to purchase N pens.

Constraints

  • 1 <= N <=10000

  • 1 <= S <= 100

  • 0 <= 0 <= 10000

  • 0 <= P<= 10000

  • O<= D <= 1000000

  • N<= 01+Q2+...+Qs

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

Автор viper1234, история, 3 года назад, По-английски

Guys Checkout this problem-https://dmoj.ca/problem/coci13c2p5
I am stuck in that I don't know why mine solution is not working.
Soln link-https://ideone.com/Mbki4p

Can anyone please tell me the correct solution for this?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится