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.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题 ...
随机推荐
- php 跳转页面
header('location:./example.php'); header('refresh:2;url=./example.php');
- shell 学习笔记8-case条件语句
一.case语句简介 1.什么是case条件语句 case条件语句就相当于多分支的if/elif/else条件语句,但是比这样的语句更规范更好看,经常被用在失效系统服务启动脚本等企业应用中 程序将ca ...
- C#正则表达式根据分组命名取值
string[] regexList = new string[] { @"^(?<TickerPart1>[0-9A-Z])[ 0_]?(?<TickerPart2> ...
- 基于【 MySql 】二 || mysql详细学习笔记
mysql重点学习笔记 /* Windows服务 */ -- 启动MySQL net start mysql -- 创建Windows服务 sc create mysql binPath= mysql ...
- lucene初探
http://www.cnblogs.com/xing901022/p/3933675.html
- Hive笔记及配置
Hive 基于Hadoop的数据仓库工具: 将结构化的数据文件,映射为一张表,并提供类SQL查询功能: 本质:将HQL转化为MapReduce程序: Hive处理的数据存储在HDFS: Hive分析数 ...
- Android笔记(三) 使得Activity之间可以跳转---Intent
什么是Intent 一个APP肯定不单单由一个Activity构成,我们在使用过程中,经常需要在多个Activity中跳转,Android中Intent可以帮我们来完成在各个Activity中跳转的功 ...
- Flutter——TabBar组件(顶部Tab切换组件)
TabBar组件的常用属性: 属性 描述 tabs 显示的标签内容,一般使用 Tab 对象,也可以是其他的Widget controller TabController 对象 isScrollabl ...
- Linux命令——rpm
翻译自:20 Practical Examples of RPM Commands in Linux 国内译文:20个Linux中RPM命令的实际示例 前言 包管理机制——RPM.dpkg rpm本身 ...
- 使用Ponysay,在Linux终端显示彩虹小马
Ponysay类似于Cowsay,可以在终端打印所有小马的像素画.还有个ponythink,这个是小马想,那个是小马说,效果如下: 安装: sudo apt-get install ponysay 使 ...