750A New Year and Hurry
1 second
256 megabytes
standard input
standard output
Limak is going to participate in a contest on the last day of the 2016. The contest will start at 20:00 and will last four hours, exactly until midnight. There will be n problems, sorted by difficulty, i.e. problem 1 is the easiest and problem n is the hardest. Limak knows it will take him 5·i minutes to solve the i-th problem.
Limak's friends organize a New Year's Eve party and Limak wants to be there at midnight or earlier. He needs k minutes to get there from his house, where he will participate in the contest first.
How many problems can Limak solve if he wants to make it to the party?
The only line of the input contains two integers n and k (1 ≤ n ≤ 10, 1 ≤ k ≤ 240) — the number of the problems in the contest and the number of minutes Limak needs to get to the party from his house.
Print one integer, denoting the maximum possible number of problems Limak can solve so that he could get to the party at midnight or earlier.
3 222
2
4 190
4
7 1
7
In the first sample, there are 3 problems and Limak needs 222 minutes to get to the party. The three problems require 5, 10 and 15 minutes respectively. Limak can spend 5 + 10 = 15 minutes to solve first two problems. Then, at 20:15 he can leave his house to get to the party at 23:57 (after 222 minutes). In this scenario Limak would solve 2 problems. He doesn't have enough time to solve 3 problems so the answer is 2.
In the second sample, Limak can solve all 4 problems in 5 + 10 + 15 + 20 = 50 minutes. At 20:50 he will leave the house and go to the party. He will get there exactly at midnight.
In the third sample, Limak needs only 1 minute to get to the party. He has enough time to solve all 7 problems.
#include <iostream> using namespace std; int main()
{
int num, party;
cin >> num >> party;
const int time = ;
party = time - party;
int ans = , n = ;
while(party > && ans < num)
{
party -= *n;
if(party >= )
{
n++;
ans ++;
}
}
cout << ans << endl;
return ;
}
750A New Year and Hurry的更多相关文章
- CodeForces 750A New Year and Hurry
#include<bits/stdc++.h> using namespace std; int main() { int n, k, i, sum; while(~scanf(" ...
- 【codeforces 750A】New Year and Hurry
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- CodeFroces--Good Bye 2016-A-New Year and Hurry(水题-模拟)
A. New Year and Hurry time limit per test 1 second memory limit per test 256 megabytes input standar ...
- 新概念英语(1-43)Hurry up!
新概念英语(1-43)Hurry up! How do you know Sam doesn't make the tea very often? A:Can you make the tea, Sa ...
- Good Bye 2016 A. New Year and Hurry【贪心/做题目每道题花费时间按步长为5等差增长,求剩余时间够做几道题】
A. New Year and Hurry time limit per test 1 second memory limit per test 256 megabytes input standar ...
- 输入一个url之后到底发生了什么 - Hurry
背景 最近学习到 nginx 方向代理发现,nginx 可以将你的请求以 http 块的 server 形式代理到请求的域名或者 ip 地址. 一个简单的 nigx 配置如下: 12345678 se ...
- vi/vim使用指北 ---- Moving Around in a Hurry
上一篇文章中,简单列出了一些基本的Vim操作,也列出了很多的光标移动命令,本章主要是有哪些命令可以更快的移动光标. vim的编辑操作,用得最多就是移动光标,对于很少行的文件来说,基本的命令就够用了,但 ...
- POJ 3858 Hurry Plotter(DP)
Description A plotter is a vector graphics printing device that connects to a computer to print grap ...
- Lesson 19 Sold out
Text 'The play may begin at any moment,' I said. 'It may have begun already,' Susan answered. I hurr ...
随机推荐
- sql server查看表占用索引空间(小技巧)
选择表右键—属性—存储—索引空间
- python 之路06day
一 字符编码 1 字符编码的定义: 计算机要想工作必须通电,即用‘电’驱使计算机干活,也就是说‘电’的特性决定了计算机的特性.电的特性即高低电平(人类从逻辑上将二进制数1对应高电平,二进制数0 ...
- python post提交数据
使用utf8编码,value是上传的值 1.上传经纬度等数据http://112.74.44.47/VehicleWeb/Acceleration?gps=gpsValue&accelera ...
- 13.从url 输入网址到最终页面渲染完成
从url 输入网址到最终页面渲染完成,发生了什么? 1.DNS解析:将域名地址解析为IP地址 先读取: -浏览器DNS缓存 -系统DNS缓存 -路由器DNS缓存 -网络运营商DNS缓存 -递归搜索:b ...
- OpenACC数据管理语句
▶ 书中第4章,数据管理部分的代码和说明 ● 代码,关于 copy,copyin,copyout,create #include <stdio.h> #include <openac ...
- bootstrap左侧边栏
之前都是想直接把导航栏放左边,但是会占一整行 网上找了好久,看到用bootstrap响应式布局,可以比较简单实现 经典的,可以参考:http://demo.qianduanblog.com/3150/ ...
- as3 连接mysql
http://www.cnblogs.com/yili16438/archive/2011/04/23/2025936.html
- mongodb基础学习13-聚集aggregate操作
aggregate可以用的操作与sql的对应关系 下面来看具体操作例子: 分组求和: 求总记录数 商品价格大于50记录分组求和 商品价格大于50且分组记录大于2的分组记录条件 分组库存数,并按库存排序 ...
- commonCookie.js
/** * Created with JetBrains WebStorm. * NAME: commonCookie.js */(function(window,document){ var com ...
- 类的"魔法"方法
1. __init__()方法 <1>使用方式 def 类名: #初始化函数,用来完成一些默认的设定 def __init__(): pass 总结1 当创建Car对象后,在没有调用__i ...