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.现在你从北极出发,按照题目输入方式来走. ...
随机推荐
- Maven手动增加依赖jar到本地Maven仓库中
Apache Maven是一个项目管理及自动构建工具,有APache软件基金会提供.我们只要配置成功后就可以通过配置pom.xml添加所需依赖的jar包和类库,因为这些类库已经在我们配置的Maven仓 ...
- Python subprocess + timeout的命令执行
Popen对象 poll() 判断是否执行完毕,执行完毕返回0,未执行完毕返回None terminate() 终止进程发送SIGTERM信号 raise 自定义返回错误 import time im ...
- 万恶的tileMap
先吐槽下.. 本来,我们准备用tileMap来做地图的,但发现一个问题,就是tileMap层中不能添加cc.Sprite,这导致了tileMap只适合做2D平面没有遮挡的游戏,并且主角是不能有效率的进 ...
- rsync 断点续传
# rsync -avzP file root@172.20.7.219:/root/tmp (我这里file指要传送的文件)
- es6 语法
1.定义变量 使用let,const.let可以定义变量,相当于var,定义的变量只在局部范围内使用.const用来定义常量. 2.解构 自动解析数组或者对象中的值,比如一个函数要返回多个值,通常的做 ...
- Kettle 使用相关
Kettle 作为国外的一款开源ETL软件,要使用了
- Socket 传送文件
1.传送文本文件 1.1服务端 package com; import java.io.BufferedWriter; import java.io.DataInputStream; import j ...
- Ubuntu下安装composer及配置
1.下载最新composer wget -c https://getcomposer.org/composer.phar 2.可执行权限 chmod u+x composer.phar 3.放置到安装 ...
- 第16 天 JavaWEB过滤器和监听器技术
Day16 JavaWEB过滤器和监听器技术 复习: 1.大结果集分页mysql的实现,是使用那个关键字,从user表中取第一页的数据,长度为10,sql语句怎么写? 2.分页查询的起始位置(star ...
- DOS下导入导出MySQL备份
导入: 1. cd d:\mysql\bin #cd 到 mysql 的 bin 目录下 2. mysql -u root -p mysql_db_name < d:\mysql\data\ba ...