博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Educational Codeforces Round 31 A. Book Reading【暴力】
阅读量:6432 次
发布时间:2019-06-23

本文共 1684 字,大约阅读时间需要 5 分钟。

A. Book Reading
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Recently Luba bought a very interesting book. She knows that it will take t seconds to read the book. Luba wants to finish reading as fast as she can.

But she has some work to do in each of n next days. The number of seconds that Luba has to spend working during i-th day is ai. If some free time remains, she can spend it on reading.

Help Luba to determine the minimum number of day when she finishes reading.

It is guaranteed that the answer doesn't exceed n.

Remember that there are 86400 seconds in a day.

Input

The first line contains two integers n and t (1 ≤ n ≤ 100, 1 ≤ t ≤ 106) — the number of days and the time required to read the book.

The second line contains n integers ai (0 ≤ ai ≤ 86400) — the time Luba has to spend on her work during i-th day.

Output

Print the minimum day Luba can finish reading the book.

It is guaranteed that answer doesn't exceed n.

Examples
input
2 2 86400 86398
output
2
input
2 86400 0 86400
output
1 【题意】:给出总天数n,读书时间t。n天内的干活时间(按秒记,一天86400秒)。求最少的读完书的天数。 【分析】:暴力。 【代码】:
#include 
using namespace std;#define inf 1e18+100#define LL long longconst int maxn = 86400+100;int main(){ LL n,t,res; //给定时间,读书时间 LL r; LL a[maxn];//干活时间 求花几天读书 while(cin>>n>>t)//2 86400 //1 86399 { res=0; for(int i=0;i
>a[i]; res+=(86400-a[i]);//86400-干活时间=留下的读书时间 if(res>=t)//剩余读书时间》需求读书时间,则可以于这天读完,直接输出该天是第几天 { cout<
<
View Code

 

转载于:https://www.cnblogs.com/Roni-i/p/7781006.html

你可能感兴趣的文章
K - Kia's Calculation (贪心)
查看>>
android笔试题一
查看>>
【JavaEE企业应用实战学习记录】getConnListener
查看>>
了解轮询、长轮询、长连接、websocket
查看>>
bzoj2427[HAOI2010]软件安装
查看>>
bzoj1593[Usaco2008 Feb]Hotel 旅馆*
查看>>
WPF个人助手更新
查看>>
NLPIR技术助力中文智能数据挖掘
查看>>
python操作redis--------------数据库增删改查
查看>>
Android中仿IOS提示框的实现
查看>>
php初学第一课
查看>>
Windows下与Linux下编写socket程序的区别 《转载》
查看>>
java学习笔记 --- IO(3)
查看>>
Mysql 的FIND_IN_SET函数慢的忧化
查看>>
Web service是什么?
查看>>
python 问题集合
查看>>
豌豆荚工程师谈其新版应用搜索技术
查看>>
螺旋阵(递归和非递归)
查看>>
我的爷爷(知识渊博的下乡知青)
查看>>
jQuery动画连续触发、滞后反复执行解决办法
查看>>