Book Reading CodeForces - 884A

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 ≤ 1001 ≤ 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
 
       


#include<bits/stdc++.h>
using namespace std;


int n,k;
int a[105];


int main()
{
    while(cin>>n>>k)//工作天数,读书需要的总时间
    {
        for(int i=0; i<n; i++)
        {
            scanf("%d",&a[i]);//每天的工作时间
        }
        int m=0,z;//天数,每天剩余时间
        for(int i=0; i<n; i++)
        {
            z=86400-a[i];//每天的剩余时间
            k-=z;//每天读完书后剩余阅读量
            m++;//天数+1
            if(k<=0)//读完这本书
            {
                printf("%d\n",m);//输出天数
                break;
            }
        }
    }
    return 0;
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值