#2719. 滑雪训练

滑雪训练

Description

小爱最近迷上了滑雪,某滑雪场有 <math xmlns="http://www.w3.org/1998/Math/MathML">n 条不同难度的雪道,只有学习并滑了第 <math xmlns="http://www.w3.org/1998/Math/MathML">i 条雪道,才能去参加第 <math xmlns="http://www.w3.org/1998/Math/MathML">i+1 条雪道的学习与训练。

已知,第一次滑第 <math xmlns="http://www.w3.org/1998/Math/MathML">i 条雪道时,需要先进行 <math xmlns="http://www.w3.org/1998/Math/MathML">ai 分钟的学习,再花 <math xmlns="http://www.w3.org/1998/Math/MathML">bi分钟滑该雪道一次,才算学习完成。若之后再滑第 <math xmlns="http://www.w3.org/1998/Math/MathML">i 条雪道,则仅需 <math xmlns="http://www.w3.org/1998/Math/MathML">bi 分钟即可滑一次。

小爱共有 <math xmlns="http://www.w3.org/1998/Math/MathML">T 分钟时间,请问如何安排才能使他能滑的圈数最多?

Input Format

输入第一行,两个正整数 <math xmlns="http://www.w3.org/1998/Math/MathML">n,T
接下来 <math xmlns="http://www.w3.org/1998/Math/MathML">n 行:每行两个正整数<math xmlns="http://www.w3.org/1998/Math/MathML">ai,bi表示第<math xmlns="http://www.w3.org/1998/Math/MathML">i条雪道需要的学习时间和滑雪时间。

Output Format

输出一个正整数,表示小爱最多可以滑的圈数。
3 100
10 20
5 5
20 10
14

Hint

先花30分钟学习第一滑道,此时共计滑了一圈
在花10分钟学习第二滑道,此时共计滑了两圈

剩余60分钟,滑第二滑道,共计滑了14圈


数据范围

  • 对于<math xmlns="http://www.w3.org/1998/Math/MathML">30%的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1n10
  • 对于<math xmlns="http://www.w3.org/1998/Math/MathML">60%的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1n103
  • 对于<math xmlns="http://www.w3.org/1998/Math/MathML">100%的数据,<math xmlns="http://www.w3.org/1998/Math/MathML">1n105<math xmlns="http://www.w3.org/1998/Math/MathML">1ai,bi,T1018


Source

上海市2023年5月 枚举