302403: CF463A. Caisa and Sugar

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Caisa and Sugar

题意翻译

## 题目描述 Caisa 要举办一个派对,他要购买巧克力蛋糕的原料。为此,他去了镇上最大的超市。 不巧,他只有 $s$ 美元买食糖。但这可不是悲伤的理由,因为超市里有 $n$ 种食糖,或许他可以买某一个。但这还没完。超市有着非常特别的找零政策:把糖果给买家作为找零,而不是美分。当然,给的糖果的数量始终不会超过 $99$,因为每个卖家都会最大化找零中美元的数量($100$ 美分可以换成 $1$ 美元)。 Caisa 只想买一种食糖,同时他也希望找零中的糖果数量最多。他最多能得到多少糖果?请注意,Caisa 并不想降低买食糖的开销,他只想得到最多的糖果找零。 ## 输入格式 第一行包含两个空格隔开的整数 $n$ 和 $s$ ($1$ $\leq$ $n$,$s$ $\leq$ $100$) 。 接下来 $n$ 行中的第 $i$ 行包含两个整数$x_i$ 和 $y_i$($1$ $\leq$ $x_i$ $\leq$ $100$;$0$ $\leq$ $y_i$ $\lt$ $100$),分别代表购买第 $i$ 种糖需要多少美元、美分。 ## 输出格式 输出一个整数,代表他最多能买到多少糖果。或者,如果他买不起任何一种食糖,则输出 $-1$。 ## 说明 在第一个样例中,Caisa 可以买第四种食糖,这种情况下他能得到 $50$ 个糖果找零。

题目描述

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.

输入输出格式

输入格式


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}&lt;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.

输出格式


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

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.

Input

题意翻译

## 题目描述 Caisa 要举办一个派对,他要购买巧克力蛋糕的原料。为此,他去了镇上最大的超市。 不巧,他只有 $s$ 美元买食糖。但这可不是悲伤的理由,因为超市里有 $n$ 种食糖,或许他可以买某一个。但这还没完。超市有着非常特别的找零政策:把糖果给买家作为找零,而不是美分。当然,给的糖果的数量始终不会超过 $99$,因为每个卖家都会最大化找零中美元的数量($100$ 美分可以换成 $1$ 美元)。 Caisa 只想买一种食糖,同时他也希望找零中的糖果数量最多。他最多能得到多少糖果?请注意,Caisa 并不想降低买食糖的开销,他只想得到最多的糖果找零。 ## 输入格式 第一行包含两个空格隔开的整数 $n$ 和 $s$ ($1$ $\leq$ $n$,$s$ $\leq$ $100$) 。 接下来 $n$ 行中的第 $i$ 行包含两个整数$x_i$ 和 $y_i$($1$ $\leq$ $x_i$ $\leq$ $100$;$0$ $\leq$ $y_i$ $\lt$ $100$),分别代表购买第 $i$ 种糖需要多少美元、美分。 ## 输出格式 输出一个整数,代表他最多能买到多少糖果。或者,如果他买不起任何一种食糖,则输出 $-1$。 ## 说明 在第一个样例中,Caisa 可以买第四种食糖,这种情况下他能得到 $50$ 个糖果找零。

加入题单

算法标签: