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 <bits/stdc++.h>

using namespace std;
#define inf 1e18+100
#define LL long long const int maxn = +; int main()
{
LL n,t,res; //给定时间,读书时间
LL r;
LL a[maxn];//干活时间 求花几天读书
while(cin>>n>>t)//2 86400 //1 86399
{
res=;
for(int i=;i<n;i++)
{
cin>>a[i];
res+=(-a[i]);//86400-干活时间=留下的读书时间
if(res>=t)//剩余读书时间》需求读书时间,则可以于这天读完,直接输出该天是第几天
{
cout<<i+<<endl;
return ;
}
}
}
}

Educational Codeforces Round 31 A. Book Reading【暴力】的更多相关文章

  1. Educational Codeforces Round 31 B. Japanese Crosswords Strike Back【暴力】

    B. Japanese Crosswords Strike Back time limit per test 1 second memory limit per test 256 megabytes ...

  2. 【Educational Codeforces Round 31 A】Book Reading

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 水模拟 [代码] #include <bits/stdc++.h> using namespace std; const ...

  3. Educational Codeforces Round 8 A. Tennis Tournament 暴力

    A. Tennis Tournament 题目连接: http://www.codeforces.com/contest/628/problem/A Description A tennis tour ...

  4. Educational Codeforces Round 1 A. Tricky Sum 暴力

    A. Tricky Sum Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem ...

  5. Educational Codeforces Round 8 B. New Skateboard 暴力

    B. New Skateboard 题目连接: http://www.codeforces.com/contest/628/problem/A Description Max wants to buy ...

  6. Educational Codeforces Round 31

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

  7. Educational Codeforces Round 19 E. Array Queries(暴力)(DP)

    传送门 题意 给出n个数,q个询问,每个询问有两个数p,k,询问p+k+a[p]操作几次后超过n 分析 分块处理,在k<sqrt(n)时,用dp,大于sqrt(n)用暴力 trick 代码 #i ...

  8. Codeforces Educational Codeforces Round 17 Problem.A kth-divisor (暴力+stl)

    You are given two integers n and k. Find k-th smallest divisor of n, or report that it doesn't exist ...

  9. 【Educational Codeforces Round 31 C】Bertown Subway

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 最后肯定会形成若干个环的. 把最大的两个环合在一起就好. 每个环贡献: 假设x=环的大小 ->x*x 注意int的溢出 [代码 ...

随机推荐

  1. USACO Section1.3 Combination Lock 解题报告

    combo解题报告 —— icedream61 博客园(转载请注明出处)---------------------------------------------------------------- ...

  2. python 由递归的dict构建树的画图代码

    createPlot(mytree)方法实现. 其中myTree是一个字典,调用retrieveTree(0)可以获得一个字典的样式. Last login: Thu Feb 23 19:07:53 ...

  3. 大图轮播js

    <!DOCTYPE html><html> <head>        <meta charset="UTF-8">         ...

  4. npm理解

    NPM就是一个下载器,通过它可以下载到几乎所有你需要的代码资源.它的成功,包括如下几个方面: 海量资源:NPM背后有数以万计的开源免费模块. 高效利用:作为开发者,只需要敲几个简单的命令就可以将这些开 ...

  5. iOS大神班笔记03-UIApplication

    UIApplication简介: UIApplication对象是应用程序的象征. 每一个应用程序都有自己的UIApplication对象,而且是单例. 一个iOS程序启动后创建的第一个对象就是UIA ...

  6. [AT2699]Flip and Rectangles

    题目大意:有一个$n\times m$的$01$矩阵,可以把任意行或列反转,问最大的全为一的子矩阵的面积 题解:有一个结论:若一个子矩形$S$中的任意一个$2\times 2$的子矩形都含有偶数个$1 ...

  7. POJ 2142 The balance | EXGCD

    题目: 求ax+by=c的一组解,使得abs(x)+abs(y)尽量小,满足前面前提下abs(ax)+abs(by)尽量小 题解: exgcd之后,分别求出让x尽量小和y尽量小的解,取min即可 #i ...

  8. mysql外网链接

    1:设置mysql的配置文件     /etc/mysql/my.cnf     找到 bind-address  =127.0.0.1  将其注释掉://作用是使得不再只允许本地访问:  重启mys ...

  9. 用hibernate.properties代替hibernate.cfg.xml配置常用的属性

    我们使用hibernate时经常在hibernate.cfg.xml文件中配置数据库连接的相关属性,是否显示sql语句,数据库的方言等,这些配置其实也可以在.properties文件中配置.现在我把这 ...

  10. bzoj 4443 [Scoi2015]小凸玩矩阵 网络流,二分

    [Scoi2015]小凸玩矩阵 Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 1564  Solved: 734[Submit][Status][Di ...