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. grunt简记

    grunt和gulp都是前端自动化的工具,grunt更成熟,插件社区全.大:gulp比较年轻,性能更好,更简单容易.具体使用哪种可根据实际项目组来决定. 创建任务 grunt默认执行的是default ...

  2. 《Cracking the Coding Interview》——第8章:面向对象设计——题目4

    2014-04-23 18:17 题目:设计一个停车位的类. 解法:停车位,就要有停车.取车的功能了.另外我还加了一个工作线程用于计费,每秒给那些有车的车位加1块钱费用. 代码: // 8.4 Des ...

  3. .netCore 反射 :Could not load file or assembly 系统找不到指定文件

    “System.IO.FileNotFoundException:“Could not load file or assembly 'ClassLibrary2, Culture=neutral, P ...

  4. Python学习-day20 django进阶篇

    Model 到目前为止,当我们的程序涉及到数据库相关操作时,我们一般都会这么搞: 创建数据库,设计表结构和字段 使用 MySQLdb 来连接数据库,并编写数据访问层代码 业务逻辑层去调用数据访问层执行 ...

  5. RGB和YUV、YCbCr 以及格式的转换总结

    比较好的文章收集链接: https://www.douban.com/note/76361504/ http://blog.sina.com.cn/s/blog_a85e142101010h8n.ht ...

  6. vue 搜索匹配

    computed: { broSeachData: function() { var browesData = this.browesData, searchVal = this.searchVal; ...

  7. 原始套接字--traceroute

    traceroute, 也就是 trace route,跟踪路由.这个程序最早是Van Jacobson实现的.源码在网上可以找到,不过我还没有去找.是IP路由过程中对数据包TTL(Time to L ...

  8. jquery select chosen禁用某一项option

    $("#tbParBudCode").chosen().change(function () { $("#tbParBudCode option[value='" ...

  9. linux perf: 为什么采样频率设置成99Hz而不是100Hz

    早晨在linuxer看到文章,感觉挺有意思,最早研究perf的时候接触过这些概念,乍一看倍感亲切. sudo perf record -F  99 -a -g --sleep 20 perf reco ...

  10. 可以在函数中间打点了,以分析bpf_prog_load函数为例

    可以在函数中间打点了, sudo stap -L 'process("./test").statement("func@test.c:10")' //12.10 ...