CodeForces 750A New Year and Hurry
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n, k, i, sum;
while(~scanf("%d%d",&n, &k))
{
sum = k;
for(i = 0; i <= n; i ++)
{
sum += i * 5;
if(sum > 240)
break;
}
printf("%d\n", i - 1);
}
return 0;
}
看懂题意就能做出来了。
题目描述:
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 ben 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?
Input
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.
Output
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.
Example
3 222
2
4 190
4
7 1
7
Note
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 spend5 + 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 solve2 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.
CodeForces 750A New Year and Hurry的更多相关文章
- 【codeforces 750A】New Year and Hurry
time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard ou ...
- 750A New Year and Hurry
A. New Year and Hurry time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Round #200 (Div. 1) B. Alternating Current 栈
B. Alternating Current Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/343 ...
- Codeforces Good Bye 2016 题解
好久没有fst题了...比赛先A了前4题然后发现room里有人已经X完题了没办法只能去打E题,结果差一点点打完...然后C题fst掉了结果就掉rating 了...下面放题解 ### [A. New ...
- Codeforces Beta Round #9 (Div. 2 Only) A. Die Roll 水题
A. Die Roll 题目连接: http://www.codeforces.com/contest/9/problem/A Description Yakko, Wakko and Dot, wo ...
- CodeForces - 344D Alternating Current (模拟题)
id=46667" style="color:blue; text-decoration:none">CodeForces - 344D id=46667" ...
- Codeforces Round #200 (Div. 2)D. Alternating Current (堆栈)
D. Alternating Current time limit per test 1 second memory limit per test 256 megabytes input standa ...
- 【25.64%】【codeforces 570E】Pig and Palindromes
time limit per test4 seconds memory limit per test256 megabytes inputstandard input outputstandard o ...
- python爬虫学习(5) —— 扒一下codeforces题面
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
随机推荐
- docker registry-v2 搭建私有仓库
参考官方文档:https://docs.docker.com/registry/deploying/ 参考 :http://www.tuicool.com/articles/6jEJZj 本例子使用两 ...
- Eclipse下使用Maven创建项目出现的archetype错误,记,转
记自:http://blog.csdn.net/ZhuboSun/article/details/50099635 [1]出现的错误提示: Unable to create project from ...
- 使用Django时需要注意的八个要点
1.在settings.py中使用os. path.dirname() 常用代码如下: # settings.py import os PROJECT_DIR = os.path.dirname(__ ...
- element-ui默认样式修改
来自 :https://blog.csdn.net/wangguoyu1996/article/details/81394707 侵删 我们在使用element-ui的时候经常会遇到需要修改组件默认样 ...
- TensorFlow实现Softmax Regression识别手写数字
本章已机器学习领域的Hello World任务----MNIST手写识别做为TensorFlow的开始.MNIST是一个非常简单的机器视觉数据集,是由几万张28像素*28像素的手写数字组成,这些图片只 ...
- stm32 SD卡
容量等级 SD容量有8MB.16MB.32MB.64MB.128MB.256MB.512MB.1GB.2GB SDHC容量有2GB .4GB.8GB.16GB.32GB SDXC容量有32GB.48G ...
- An incompatible version [1.2.10] of the APR based Apache Tomcat Native library is installed, while Tomcat requires version [1.2.14]
这个链接的博主写的很详细,直接推荐:https://blog.csdn.net/zhoukikoo/article/details/80532483
- java 扫描微信公众号二维码,关注并登录逻辑
场景:户扫描微信公众号的二维码,关注后自动登录网站,若已关注则直接登录. 逻辑: 系统生成带参数的临时二维码:参数 scene_str 自定义为唯一值(可以是uuid),临时二维码的生成方式参照官方接 ...
- zabbix server for Centos 6.3
1.安装LNMP 参照http://lnmp.org/install.html 2.安装zabbix service 2.1下载zabbix,并解压 wget http://nchc.dl.sourc ...
- 【TestNG】使用代码方式调用TestNG用例执行
TestNG的用例除了直接运行之外,还可以使用代码来调用,这样做的好处在于我们可以将其嵌入其他代码中,来执行这些TestNG用例,方法如下: 1.直接调用用例类 范例:定义了两个测试用例类为Depen ...