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的溢出 [代码 ...
随机推荐
- 【Power of Two】cpp
题目: Given an integer, write a function to determine if it is a power of two. 代码: class Solution { pu ...
- python之路——网络编程
一.楔子 你现在已经学会了写python代码,假如你写了两个python文件a.py和b.py,分别去运行,你就会发现,这两个python的文件分别运行的很好.但是如果这两个程序之间想要传递一个数据, ...
- OpenStack-Ironic裸金属简介
一,Ironic简述 简而言之,OpenStack Ironic就是一个进行裸机部署安装的项目. 所谓裸机,就是指没有配置操作系统的计算机.从裸机到应用还需要进行以下操作: (1)硬盘RAID ...
- Spring 学习笔记(二)—— IOC 容器(BeanFactory)
使用Spring IoC容器后,容器会自动对被管理对象进行初始化并完成对象之间的依赖关系的维护,在被管理对象中无须调用Spring的API. 为了实现IoC功能,Spring提供了两个访问接口: or ...
- 第二章 Internet 地址结构
注意: 这个系列的博客只是为了巩固我学习的知识,参考的价值不是很大,如果需要,请转到http://www.cnblogs.com/ZCplayground/p/7764436.html Interne ...
- myEclipse如何将程序部署到tomcat(附录MyEclipse调试快捷键)
部署 1.选中你要部署的项目,在工具栏找到 Deploy MyEclipse J2EE Project to Server 2.单击Add,即出现如下界面.选择相应的Server,要和你在配置tomc ...
- Vuex, api, SSR, module
vuex https://vuex.vuejs.org/zh/guide/actions.html 单向数据流 单例模式 & 多个组件共享状态 State & 状态注入 Vue.use ...
- LeetCode -- Implement Stacks using Queue
Question: Implement the following operations of a queue using stacks. push(x) -- Push element x to t ...
- HDU 4585 Shaolin(Treap找前驱和后继)
Shaolin Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total Su ...
- [CF954G]Castle Defense
题目大意:有$n$个点,每个点最开始有$a_i$个弓箭手,在第$i$个位置的弓箭手可以给$[i-r,i+r]$区间加上$1$的防御,你还有$k$个弓箭手,要求你最大化最小防御值 题解:二分答案,从右向 ...