关闭

A. New Year and Hurry

434人阅读 评论(0) 收藏 举报
分类:

time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
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 nis the hardest. Limak knows it will take him 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 kminutes 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 ≤ 101 ≤ 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.

Examples
input
3 222
output
2
input
4 190
output
4
input
7 1
output
7
Note

In the first sample, there are 3 problems and Limak needs 222 minutes to get to the party. The three problems require 510 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 2problems. 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<cstdio>
#include <cstring>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<vector>
#include <map>
using namespace std;

int main()
{
	int n,k,i,count=0;
	scanf("%d %d",&n,&k);
	for(i=1;i<=n;i++)
	{	
		if(5*i*(i+1)+2*k<=480)
		{
			count++;
		}
	}
	printf("%d\n",count);
	return 0;
}


0
0
查看评论
发表评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场

New Year Permutation(并查集+动态容器)

B. New Year Permutation  time limit per test2 seconds  memory limit per test256 megabytes  inputstandard input  outputstandard...
  • qq_35634181
  • qq_35634181
  • 2016-09-23 14:41
  • 116

程序实践:万年历

万年历系统 #include #include char* month_str[]={"January","February","March","April","May","June...
  • Tc_To_Top
  • Tc_To_Top
  • 2015-01-31 14:09
  • 911

【Educational Codeforces Round 6E】【线段树 dfs序】New Year Tree 子树颜色修改子树颜色数

E. New Year Tree time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output...
  • snowy_smile
  • snowy_smile
  • 2016-03-01 18:22
  • 684

Java程序设计 试卷A

2016 – 2017 学年第一学期 期末考试试卷   课程名称:Java程序设计 试卷类型:A卷 共10页  考试形式:闭卷
  • yqj2065
  • yqj2065
  • 2016-12-31 13:04
  • 616

java--类的封装性(2)

浅拷贝与深拷贝浅拷贝传递引用,不能复制实例 深拷贝创建新实例,复制实例package day14;import java.util.Calendar; public class MyDate { private int year,month,day; private static i...
  • xanlv
  • xanlv
  • 2016-10-11 20:57
  • 224

python沙箱逃逸小结

之前碰到了flask模板的漏洞的时候接触过python的一些东西,之前没时间去细看,现在看感觉很强悍,简单总结一下 首先我们不说原理了,也不是太明白,我们直接讲利用,一些python好玩的特性1.内联函数python的内敛函数真是强大,可以调用一切函数做自己想做的事情 我们输入dir('...
  • qq_35078631
  • qq_35078631
  • 2017-11-11 03:25
  • 253

sql语句练习(2)

1.请用一个sql语句得出结果 从table1,table2中取出如table3所列格式数据,注意提供的数据及结果不准确,只是作为一个格式向大家请教。 如使用存储过程也可以。 table1 月份mon 部门dep 业绩yj ------------------------------- 一月份&...
  • Happy_wu
  • Happy_wu
  • 2016-09-11 18:19
  • 710

Codeforces 379D. New Year Letter【动态规划、暴力枚举】

题目大意: 给出如下定义: s(n)=s(n-2)+s(n-1),其中s为字符串,+为串联,比如s1="ab",s2="cd",s1+s2="abcd",s2+s1="cdab"。 给出k,x,n,m,求满足使字符串...
  • u013912596
  • u013912596
  • 2014-08-23 22:25
  • 486

611C. New Year and Domino【二维前缀和】【容斥】

C. New Year and Domino time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output They s...
  • wlx65003
  • wlx65003
  • 2015-12-31 18:59
  • 1099

hpu暑假训练G - New Year and Days【数学】

Today is Wednesday, the third day of the week. What's more interesting is that tomorrow is the last day of the year 2015. Limak is a little polar ...
  • tian_he_he
  • tian_he_he
  • 2017-07-28 18:07
  • 78
    个人资料
    • 访问:2079125次
    • 积分:37044
    • 等级:
    • 排名:第132名
    • 原创:1496篇
    • 转载:121篇
    • 译文:19篇
    • 评论:953条
    最新评论