Nội dung Bài tập
Mã:
Assembly
Tên:
Assembly
Dạng thi:
oi
Thang điểm:
10 điểm
Giới hạn thời gian:
1 giây
Giới hạn bộ nhớ:
64 MB
Được tạo bởi:
admin
The Alternate Control Machine (ACM) Factory has a large assembly line to make a type of product. The assembly has N robots (R1,R2,… ,RN) working sequentially. That means a semi-finished product moves from robot R1, to R2, then to R3… to RN. Each robot adds a component to the product. Each robot can complete its own job in Pi products per one hour.
The company has a budget of M VNĐ to improve productivity for the entire assembly. As a product director, you know that robot Ri needs to invest Mi VNĐ to contribute to the production of one more product per hour. You have to optimize the amount of money to invest to each robot to produce maximum number of products per hour.

Input
The first line of input contains one integer T (1≤T≤10) - the number of test cases.
Then T test cases are given as follows:

 The first line of each test case contains an integer N (1≤N≤105) and an integer M (0≤M≤1012) – the number of robots and the budget

 Line i-th of the next N lines contains two integers Pi (1≤P≤109) and Mi (1≤Mi≤109) – information of the robot i-th

Output
For each test case, output in one line the maximum number of products the assembly can make after investing at most M VNĐ.



    Quảng cáo
       Ngôn ngữ : 

       Theme : 
Mời bạn soạn code



		



      Ai có thể xem bài này : 

Thông tin



Phần thảo luận