CodeFroces--Good Bye 2016-A-New Year and Hurry(水题-模拟)
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 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.
题目大意:
在240-k分钟内最多可做多少道题目?
每道题目花费的时间为 5*i 分钟
代码:
#include<bits/stdc++.h>
using namespace std;
const int SUM=240;
int main()
{
int n,k;
int t;
cin>>n>>k;
t=SUM-k;
int flag=0;
int s=0;
for(int i=0;i<=n;i++){
s+=(i*5);
if(s>t){
break;
}
else{
flag=i;
}
}
cout<<flag<<endl;
}
CodeFroces--Good Bye 2016-A-New Year and Hurry(水题-模拟)的更多相关文章
- CodeFroces--Good Bye 2016-B--New Year and North Pole(水题-模拟)
B. New Year and North Pole time limit per test 2 seconds memory limit per test 256 megabytes input s ...
- Good Bye 2016 A. New Year and Hurry【贪心/做题目每道题花费时间按步长为5等差增长,求剩余时间够做几道题】
A. New Year and Hurry time limit per test 1 second memory limit per test 256 megabytes input standar ...
- Codeforces Good Bye 2015 A. New Year and Days 水题
A. New Year and Days 题目连接: http://www.codeforces.com/contest/611/problem/A Description Today is Wedn ...
- codeforces Good bye 2016 E 线段树维护dp区间合并
codeforces Good bye 2016 E 线段树维护dp区间合并 题目大意:给你一个字符串,范围为‘0’~'9',定义一个ugly的串,即串中的子串不能有2016,但是一定要有2017,问 ...
- Codeforces Good Bye 2016 E. New Year and Old Subsequence
传送门 题意: 给出一个长度为\(n\)的串,现在有\(q\)个询问,每个询问是一个区间\([l,r]\),要回答在区间\([l,r]\)中,最少需要删多少个数,满足区间中包含\(2017\)的子序列 ...
- Good Bye 2016
A - New Year and Hurry (water) #include <bits/stdc++.h> using namespace std; int main() { ]; ; ...
- Good Bye 2016 - D
题目链接:http://codeforces.com/contest/750/problem/D 题意:新年烟花爆炸后会往两端45°差分裂.分裂完后变成2部分,之后这2部分继续按这种规则分裂.现在给你 ...
- Good Bye 2016 - C
题目链接:http://codeforces.com/contest/750/problem/C 题意:在CF中,每个人都有个Rank值. 当Rank>=1900时,为DIV1.Rank< ...
- Good Bye 2016 - B
题目链接:http://codeforces.com/contest/750/problem/B 题意:地球的子午线长度为40000,两极点的距离为20000.现在你从北极出发,按照题目输入方式来走. ...
随机推荐
- android设备的vpn功能
VPN是什么? VPN:Virtual Private Network,虚拟专用网络:是通过私有的隧道技术在公共数据网络上仿真一条点到点的专线技术,其实质上就是利用加密技术在公网上封装出一个数据通讯隧 ...
- tabbar颜色与文字大小,状态栏样式
tabbar文字颜色与大小 [self.tabBarItem setTitleTextAttributes:@{NSForegroundColorAttributeName : [UIColor wh ...
- mx51的三个framebuffer,mxc_ipuv3_fb.c分析
转载:http://blog.csdn.net/jack_a8/article/details/43309169 mx51支持三个framebuffer:fb0, fb1, fb2 /dev/grap ...
- docker命令和后台参数
Docker官方为了让用户快速了解Docker,提供了一个 交互式教程 ,旨在帮助用户掌握Docker命令行的使用方法. Docker 命令行 下面对Docker的命令清单进行简单的介绍,详细内容在后 ...
- SQL 查询优化 索引优化
sql语句优化 性能不理想的系统中除了一部分是因为应用程序的负载确实超过了服务器的实际处理能力外,更多的是因为系统存在大量的SQL语句需要优化. 为了获得稳定的执行性能,SQL语句越简单越好.对复杂的 ...
- Openlayer 3 删除上一次绘制的图
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- js检测文章敏感词
在一些博客或者论坛中,文章中的敏感词需要显示出来和高亮显示起到提示用户的作用.这个功能实现的方法有很多,下面是js的实现方式. //将文章中匹配到的敏感词罗列出来 <span style=&qu ...
- 变更mysql数据库文件目录 Linux
本次需要将mysql默认的数据库文件路径/var/lib/mysql 改为新挂载的目录/data/mysql上,需要做以下修改 1.停止mysql服务 service mysqld stop 2.复制 ...
- 郑州尚学堂:如何在Java中创建对象
作为Java开发者,每天都会创建大量的对象,但是,我们总是使用管理依赖系统(如Spring框架)来创建这些对象.其实还有其他方法可以创建对象,在接下来的文章中我会进行详细介绍. 1.使用new关键字 ...
- 设计模式 --迭代器模式(Iterator)
能够游走于聚合内的每一个元素,同时还可以提供多种不同的遍历方式. 基本概念: 就是提供一种方法顺序访问一个聚合对象中的各个元素,而不是暴露其内部的表示. 使用迭代器模式的优点: 遍历集合或者数 ...