codeforces——750A——New Year and Hurry

来源:互联网 发布:淘宝网店开店咋么进货 编辑:程序博客网 时间:2024/04/29 19:13
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 ben problems, sorted by difficulty, i.e. problem1 is the easiest and problem n is 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 needsk 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 andk (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 needs222 minutes to get to the party. The three problems require5, 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 (after222 minutes). In this scenario Limak would solve 2 problems. He doesn't have enough time to solve 3 problems so the answer is2.

In the second sample, Limak can solve all 4 problems in5 + 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 all7 problems.


240min内除去去party的时间,问能做几道题,每道题都比前一道所需时间多5min,最多做n道。划水~


#include <iostream>#include<cstring>#include<string>#include<stdio.h>#include<algorithm>#include<set>#define MAX 1e9using namespace std;int main(){    int com[12];    for(int i=0; i<=10; i++)        com[i]=2.5*(i+1)*i;    com[11]=MAX;    int n,m;    while(cin>>n>>m!=NULL)    {        m=240-m;        for(int i=1;; i++)            if(com[i]>m)            {                if(i-1>n)                    cout<<n<<endl;                else                    cout<<i-1<<endl;                break;            }    }    return 0;}


原创粉丝点击