아직 만들고 있는 페이지입니다.

이 페이지는 아직 만드는 중입니다. 보이는 내용은 바뀔 수 있습니다.

Seed Purchasing

면접 대비

시간 제한1초메모리 제한1024 MB

요약
씨앗 예산과 각 봉지의 가격, 작물 수확량, 작물 판매가가 주어질 때 얻을 수 있는 최대 수확 수익을 구한다.
난이도

보통10점 중 5점

유형
동적 계획법, 그리디, 수학, 구현
정답자
아직 제출이 없습니다

문제

The new season has begun, and it is time to purchase all new seeds. But there are so many choices! And so many variables. Every bag of seeds costs a certain amount, and each bag also produces a certain number of crops, which each sells for a certain amount of money. It’s awful to keep track of, and you simply can’t do all the math in your head. Create a program to determine the maximum amount of money you can earn on crops this year given the amount you have available to spend on seeds.

입력

The first line will contain a single integer n that indicates the number of data sets that follow. Each data set will start with a single integer x denoting how many different seed choices there are, followed by a floating point number y denoting how much you have to spend. The next x lines will consist of a floating point number c, an integer m, and a floating point number p, representing the cost of each bag, the number of crops it produces, and the selling price of each crop the bag produces. The store has an unlimited supply of each variety of seeds.

출력

For each test case, output the maximum amount of money you can make selling crops this season. Do not include the change from your seed purchases in the answer.

예제1

  1. 예제 1

    입력
    1
    4 15.00
    2.00 7 1.00
    1.00 4 1.00
    11.00 10 5.00
    5.00 1 5.00
    
    예상 출력
    $51.00