codeforces——750A——New Year and Hurry
来源:互联网 发布:淘宝网店开店咋么进货 编辑:程序博客网 时间:2024/04/29 19:13
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 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 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?
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.
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.
3 222
2
4 190
4
7 1
7
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;}
- codeforces——750A——New Year and Hurry
- 【codeforces 750A】New Year and Hurry
- codeforces 750A New Year and Hurry
- 【codeforces 750A】New Year and Hurry
- codeforces 750New Year and Hurry
- 750A- New Year and Hurry
- 750A New Year and Hurry
- A. New Year and Hurry
- goodbye 2016 A New Year and Hurry
- New Year and Hurry
- codeforces——500A—— New Year Transportation
- Codeforces — 723A. The New Year: Meeting Friends
- CodeForces 611A New Year and Days
- 【CodeForces】[659A]New Year and Days
- CodeForces 611A New Year and Days
- 【CodeForces 611A】New Year and Days
- codeforces 611A New Year and Days
- codeforces——723A—— The New Year: Meeting Friends
- replica分析
- com.Android.build.api.transform.TransformException:Java.util.zip.ZipException异常
- FindBugs-IDEA插件的使用
- wpf 库推荐
- kotlin 中intent的传值应用
- codeforces——750A——New Year and Hurry
- CentOS 默认iptables
- Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean
- Python入门学习之---------Python数字表达式和输出
- MySql笔记
- adb 打开系统界面和后退
- VSFTP: Login failure: 530 Login incorrect的解决办法
- Tomcat之并发优化
- Partition分析