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 ...
随机推荐
- 小朋友学C++(1)
Hello World! 在学C++之前,最好先学习一下C语言 让我们先运行一段简单的代码,编译器可以使用 在线C++编译器 或 Xcode(苹果系统) 或Dev C++(Windows系统). #i ...
- js中, match和exec方法的区别
1. 来源分别为: string.match(reg) 和 RegExp.exec(str): 2. 区别 > 现有 字符串s1 和 正则对象 r1. 目标: 抽出s1中的所有电话号码 ...
- DOS中判断进程是否存在的方法
这里分享的主要是通过批处理中先判断进程是否存在,然后再做出操作的实现代码,需要的朋友可以参考下 检测进程是否存在,并做出预定动作. tasklist /nh>d:\tddown~1\1.tx ...
- js实现复选框的全选和全不选
<!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content ...
- OpenACC 计算规约时发现的小坑
▶ 使用 OpenACC 的 parallel 构件来计算规约,主要想说的是 win10 pgi 和 win10 WSL pgi 结果的不同和关于 for 循环的一个小坑 ● 正常的代码 #inclu ...
- Sqlserver查询数据库文件大小和剩余空间
在MS Sql Server中可以能过以下的方法查询出磁盘空间的使用情况及各数据库数据文件及日志文件的大小及使用利用率: 1.查询各个磁盘分区的剩余空间:Exec master.dbo.xp_fixe ...
- IdUDPServer中文汉字乱码 及IdTCPClient
官网 http://www.indyproject.org/docsite/html/frames.html?frmname=topic&frmfile=TIdTCPServer_OnExec ...
- input 提交属性 hidden属性
name名字最好和你后台属性的成员变量对应,否则在参数传递的时候接收不到出现空指针异常.一般表单提交后input会以name的值=value的值的形式传给后台.如:<input type=&qu ...
- 了解innodb_support_xa(分布式事务)
innodb_support_xa可以开关InnoDB的xa两段式事务提交.默认情况下,innodb_support_xa=true,支持xa两段式事务提交.此时MySQL首先要求innodb pre ...
- git命令图片