A. New Year and Hurry

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;
}


本文详细介绍了如何利用Python语言结合MySQL数据库开发一个学生管理系统。通过这一过程,读者不仅能够掌握系统设计的基本思路,还能学习到如何使用Python进行数据库操作。该系统涵盖了用户界面设计、数据验证以及数据库的增删改查等多个关键环节。 Python作为一种高级编程语言,以简洁易懂著称,广泛应用于数据分析、机器学习和网络爬虫等领域,同时也非常适合用于快速开发数据库管理应用。MySQL是一个广泛使用的开源关系型数据库管理系统,具有轻量级、高性能、高可靠性和良好的编程语言兼容性等特点,是数据存储的理想选择。在本系统中,通过Python的pymysql库实现了与MySQL数据库的交互。 pymysql是一个Python第三方库,它允许程序通过类似DB-API接口连接MySQL数据库,执行SQL语句并获取结果。在系统中,通过pymysql建立数据库连接,执行SQL语句完成数据的增删改查操作,并对结果进行处理。 系统采用命令行界面供用户操作。程序开始时,提示用户输入学生信息,如学号、姓名和各科成绩,并设计了输入验证逻辑,确保数据符合预期格式,例如学号为1至3位整数,成绩为0至100分的整数。 数据库设计方面,系统使用名为“test”的数据库和“StuSys”表,表中存储学生的学号、姓名、各科成绩及总成绩等信息。通过pymysql的cursor对象执行SQL语句,实现数据的增删改查操作。在构建SQL语句时,采用参数化查询以降低SQL注入风险。 系统在接收用户输入时进行了严格验证,包括正则表达式匹配和数字范围检查等,确保数据的准确性和安全性。同时,提供了错误处理机制,如输入不符合要求时提示用户重新输入,数据库操作出错时给出相应提示。 在数据库操作流程中,用户可以通过命令行添加学生信息或删除记录。添加时会检查学号是否重复以避免数据冲突,删除时需用户确认。通过上述分析,本文展示了从
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值