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

总结

水题,不解释


目录
相关文章
|
人工智能 算法 数据挖掘
技术沙龙直播|3D-Speaker多模态说话人开源详解
技术沙龙直播|3D-Speaker多模态说话人开源详解
|
存储 NoSQL 关系型数据库
【MongoDB 专栏】MongoDB 与传统关系型数据库的比较
【5月更文挑战第10天】本文对比了MongoDB与传统关系型数据库在数据模型、存储结构、扩展性、性能、事务支持、数据一致性和适用场景等方面的差异。MongoDB以其灵活的文档模型、优秀的扩展性和高性能在处理非结构化数据和高并发场景中脱颖而出,而关系型数据库则在事务处理和强一致性上更具优势。两者各有适用场景,选择应根据实际需求来定。随着技术发展,两者正相互融合,共同构建更丰富的数据库生态。
850 1
【MongoDB 专栏】MongoDB 与传统关系型数据库的比较
|
负载均衡 Java 网络安全
gateway基本配置
gateway基本配置
3156 4
|
算法 编译器 C语言
循环与分支——猜数字游戏实现(上)
循环与分支——猜数字游戏实现(上)
153 0
|
Python
appium--desktop
appium--desktop
|
传感器 SQL NoSQL
【物联网架构】最适合物联网的开源数据库
【物联网架构】最适合物联网的开源数据库
|
存储 JSON NoSQL
【mongo 系列】mongodb 学习二,mongodb 的基本使用梳理
• 文档 是 mongodb 的最小数据集单位,是多个键值对有序租户在一起的数据单元,类似于关系型数据库的记录
346 4
|
Python
PIP是什么
PIP 是 Python 包或模块的包管理器。
463 0
PIP是什么
|
传感器 Java C语言
Github使用
Github使用
|
机器学习/深度学习 决策智能
矩阵分析 (六) 矩阵的函数
矩阵分析 (六) 矩阵的函数
282 0