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 ...
随机推荐
- VFS文件系统结构分析
VFS是Linux非常核心的一个概念,linux下的大部分操作都要用到VFS的相关功能.这里从使用者的角度,对VFS进行了简单说明.使用者不但需要知道Linux下有哪些文件操作的函数,还需要对VFS的 ...
- ajaxGet 获取封装
callback 表示下一个功能(回调函数) function ajaxGet(url,callback,data){ 如果路径上有参数 就在url后面拼接参数 否则只请求url ...
- IDEA在编辑时提示could not autowire
IDEA在编辑时提示could not autowire 原创 2016年05月14日 10:53:38 28338 在开发中我再applicationContext-dao.xml中加入了mappe ...
- tomcat启动原理
2018年04月12日 19:55:22 太极小帅帅 阅读数:282 前言 一直在用Tomcat,但是对其启动原理一直没去研究,这里准备去面试,可能会问道.于是总结了下启动原理.完全凭感觉去揣测, ...
- mysql级联删除
一个building对应多个rooms,building删除----级联删除相关的rooms 第一步, 创建buildings表,如下创建语句: USE testdb; CREATE TABLE bu ...
- ganglia
A.lamp界面快速搭建---------------------------------------------------------------------------------------- ...
- centos7.3nginx配置二级域名过程
nginx1.10.2 1先检查 /etc/nginx/nginx.conf 是否include conf.d include /etc/nginx/conf.d/*.conf; 默认都是包含的,如 ...
- pythone--002
元组就是不可修改: 字典的索引不是自增的. 元组和列表是: 默认 是key 通过get 没有这个key 是none get可以有默认值: 通过索引 没有就报错. 检查字典中某个可以是否存在:ha ...
- 6、SpringMVC源码分析(1):分析DispatcherServlet.doDispatch方法,了解总体流程
所有的http请求都会交给DispatcherServlet类的doDispatch方法进行处理,将DispatcherServlet.doDispatch函数的javadoc复制到下面: /* * ...
- AS3 os与version 区别 使用Capabilities类获取Flash Player的信息
AS3中flash.system.Capabilities类提供诸多静态的只读属性来描述应用程序当前所运行在的系统和运行时信息,如Flash Player,Adobe AIR,Flash Lite.通 ...