New Year and Hurry

简介: New Year and Hurry

文章目录

一、 New Year and Hurry

总结


一、 New Year and Hurry

本题链接:New Year and Hurry


题目:

A. New Year and Hurry

time limit per test1 second

memory limit per test256 megabytes

inputstandard input

outputstandard 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?


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.


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 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.


本博客给出本题截图:

image.png

image.png

题意:解题的速度为5 * i,到达的时间为k,问在240分钟内能做出几道题

AC代码

#include <iostream>
using namespace std;
int main()
{
    int n, k;
    cin >> n >> k;
    k = 240 - k;
    for (int i = 1; i <= n; i ++ )
    {
        k -= i * 5;
        if (k < 0) 
        {
            cout << i - 1 << endl;
            exit(0);
        }
    }
    cout << n << endl;
    return 0;
}

总结

水题,不解释


目录
相关文章
|
3月前
|
机器人
week 0
这篇文章是关于机器人产业发展的介绍,以及一个以四足机器狗为平台的课程概览,课程内容包括机器人运动学、嵌入式开发和ROS等,旨在教授学生理解机器人系统的构成和工作原理,并进行项目实践。
26 0
week 0
|
5月前
|
C++
【C++】日期类Date(详解)②
- `-=`通过复用`+=`实现,`Date operator-(int day)`则通过创建副本并调用`-=`。 - 前置`++`和后置`++`同样使用重载,类似地,前置`--`和后置`--`也复用了`+=`和`-=1`。 - 比较运算符重载如`&gt;`, `==`, `&lt;`, `&lt;=`, `!=`,通常只需实现两个,其他可通过复合逻辑得出。 - `Date`减`Date`返回天数,通过迭代较小日期直到与较大日期相等,记录步数和符号。 ``` 这是236个字符的摘要,符合240字符以内的要求,涵盖了日期类中运算符重载的主要实现。
|
5月前
|
定位技术 C语言 C++
C++】日期类Date(详解)①
这篇教程讲解了如何使用C++实现一个日期类`Date`,涵盖操作符重载、拷贝构造、赋值运算符及友元函数。类包含年、月、日私有成员,提供合法性检查、获取某月天数、日期加减运算、比较运算符等功能。示例代码包括`GetMonthDay`、`CheckDate`、构造函数、拷贝构造函数、赋值运算符和相关运算符重载的实现。
new Date()
new Date()
113 0
|
存储 JavaScript 前端开发
new Date(dateString)
new Date(dateString)
111 0
|
Java 数据格式 XML
Today's harvest !!!
今天将Mybatis的视频看到了第60集,其之前讲解了自表的主外键查询.例如一个新闻表中,有一级栏目,二级栏目,三级栏目,其中二级栏目的pid为一级栏目的id,如此种种.而今天做的小项目中使用了 easyui 这个前端框架来做后端数据的解析.
1164 0
|
机器学习/深度学习 算法 数据挖掘
week3
6 逻辑回归(Logistic Regression) 6.1 分类(Classification) 6.2 假设函数表示(Hypothesis Representation) 6.
1267 0