CF463A.Caisa and Sugar

普及-

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Caisa is going to have a party and he needs to buy the ingredients for a big chocolate cake. For that he is going to the biggest supermarket in town.

Unfortunately, he has just s dollars for sugar. But that's not a reason to be sad, because there are n types of sugar in the supermarket, maybe he able to buy one. But that's not all. The supermarket has very unusual exchange politics: instead of cents the sellers give sweets to a buyer as a change. Of course, the number of given sweets always doesn't exceed 99, because each seller maximizes the number of dollars in the change (100 cents can be replaced with a dollar).

Caisa wants to buy only one type of sugar, also he wants to maximize the number of sweets in the change. What is the maximum number of sweets he can get? Note, that Caisa doesn't want to minimize the cost of the sugar, he only wants to get maximum number of sweets as change.

凯萨要举办一场派对,需要购买制作一个大型巧克力蛋糕的原料。为此,他来到了镇上最大的超市。

不幸的是,他仅有 s 美元用于购买糖。但这并不值得难过,因为超市里有 n 种不同的糖,他或许能买其中一种。然而,这还不是全部。该超市有着非常特殊的找零规则:卖家不给顾客找零美分,而是用糖果代替找零。当然,每次给出的糖果数量一定不超过 99 颗,因为每位卖家都力求使找零中美元部分最大化(即每满 100 美分就换成 1 美元)。

凯萨只想购买一种糖,并且希望获得尽可能多的糖果作为找零。他最多能获得多少颗糖果?注意,凯萨并不想最小化糖的花费,他唯一的目标是使作为找零的糖果数量最大化。

输入格式

The first line contains two space-separated integers n, s (1 ≤ n, s ≤ 100).

The i-th of the next n lines contains two integers x__i, y__i (1 ≤ x__i ≤ 100; 0 ≤ y__i < 100), where x__i represents the number of dollars and y__i the number of cents needed in order to buy the i-th type of sugar.

第一行包含两个以空格分隔的整数 nn 和 ss(1≤n,s≤1001 \leq n, s \leq 100)。

接下来的 nn 行中,第 ii 行包含两个整数 xix_i、yiy_i(1≤xi≤1001 \leq x_i \leq 100;0≤yi<1000 \leq y_i < 100),其中 xix_i 表示购买第 ii 种糖所需的美元数,yiy_i 表示所需的美分数。

输出格式

Print a single integer representing the maximum number of sweets he can buy, or -1 if he can't buy any type of sugar.

输出一个整数,表示他最多能购买的糖果数量;如果他无法购买任何一种糖,则输出 −1-1。

输入输出样例

  • 输入#1

    5 10
    3 90
    12 0
    9 70
    5 50
    7 0

    输出#1

    50
  • 输入#2

    5 5
    10 10
    20 20
    30 30
    40 40
    50 50

    输出#2

    -1

说明/提示

In the first test sample Caisa can buy the fourth type of sugar, in such a case he will take 50 sweets as a change.

在第一个测试样例中,Caisa 可以购买第四种糖,此时他将获得 50 颗糖果作为找零。

输入解题思路,AI测评打分。不知道怎么写?

首页