Educational Codeforces Round 31 A. Book Reading【暴力】
2 seconds
256 megabytes
standard input
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.
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.
Print the minimum day Luba can finish reading the book.
It is guaranteed that answer doesn't exceed n.
2 2
86400 86398
2
2 86400
0 86400
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【暴力】的更多相关文章
- 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 ...
- 【Educational Codeforces Round 31 A】Book Reading
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 水模拟 [代码] #include <bits/stdc++.h> using namespace std; const ...
- Educational Codeforces Round 8 A. Tennis Tournament 暴力
A. Tennis Tournament 题目连接: http://www.codeforces.com/contest/628/problem/A Description A tennis tour ...
- Educational Codeforces Round 1 A. Tricky Sum 暴力
A. Tricky Sum Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/598/problem ...
- Educational Codeforces Round 8 B. New Skateboard 暴力
B. New Skateboard 题目连接: http://www.codeforces.com/contest/628/problem/A Description Max wants to buy ...
- Educational Codeforces Round 31
A. Book Reading time limit per test 2 seconds memory limit per test 256 megabytes input standard inp ...
- 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 ...
- 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 ...
- 【Educational Codeforces Round 31 C】Bertown Subway
[链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 最后肯定会形成若干个环的. 把最大的两个环合在一起就好. 每个环贡献: 假设x=环的大小 ->x*x 注意int的溢出 [代码 ...
随机推荐
- USACO Section1.2 Transformations 解题报告
transform解题报告 —— icedream61 博客园(转载请注明出处)------------------------------------------------------------ ...
- Python 3基础教程15-读文件内容
前面两篇关于写文件和更新文件内容,我们最后都是手动去打开检查是否更新了.现在我们这里通过函数读取之前文件内容,打印到屏幕终端. 运行结果:
- Eclipse 出现“polling news feeds”的解决办法
小编突然心血来潮,安装了一下Java的环境,eclipse的IDE来写点Java,但是是不是出现以下的弹窗,实在是闹心,后来网上看了前辈们的解决办法,特此记录一下.如有侵权,敬请告知!!! 1. 找到 ...
- mysql用root账户建立用户和赋予权限
1.创建用户 create user guest_test@localhost identified by "root";-- 创建名为guest_test的用户 2.赋予权限 - ...
- Robot Framwork +Selenium2环境搭建
Robot Framwork +Selenium2环境搭建 安装python 参考文章http://blog.csdn.net/sealion111/article/details/78690686 ...
- Canvas 给图形绘制阴影
/** * 图形绘制阴影 */ function initDemo6() { var canvas = document.getElementById("demo6"); if ( ...
- python作业:模拟登陆(第一周)
模拟登陆作业需求: 1. 用户输入帐号密码进行登陆 2. 用户信息保存在文件内 3. 用户密码输入错误三次后锁定用户 额外实现功能: 1.提示输入错误次数 2.输入已锁定用户会提示 3.用户不存在会提 ...
- JavaWeb笔记(七)Filter&Listener
Filter 实现Filter接口 一般用于完成通用的操作,如:登陆验证.统一编码处理.敏感字符过滤等 执行流程 执行过滤器 执行放行后的资源 继续执行过滤器放行代码下的代码 配置 拦截路径配置 注解 ...
- [译]如何禁止Requests库的log日志信息呢?
原文来源: https://stackoverflow.com/questions/11029717/how-do-i-disable-log-messages-from-the-requests-l ...
- JSP/Servlet Web 学习笔记 DayFour
Servlet概述 Servelt是使用Java Servlet应用程序接口及相关类和方法的Java程序. Servlet是用Java编写的Server端程序,它与协议和平台无关.Servlet运行于 ...