A9633 | Caisa and Sugar
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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}<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.
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.
输出格式
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.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted