Codeforces Educational Codeforces Round 31
来源:互联网 发布:网校用什么软件 编辑:程序博客网 时间:2024/05/21 10:16
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 286400 86398
2
2 864000 86400
1
题意:Luba 想花 t 秒来读书,但是每天Luba要花ai秒来工作,ta只能在没有工作时看书,问多少天能看 t 秒的书,天数不会超过n
#include<iostream>#include<string.h>#include<stdio.h>using namespace std;#define LL long longint main(){ int n,t,a,ans = 0; scanf("%d%d",&n,&t); for(int i=1;i<=n;i++){ scanf("%d",&a); t -= (86400-a); if(t<=0&&ans==0) ans = i; } cout<<ans<<endl;; return 0;}
- Codeforces Educational Codeforces Round 31
- Codeforces Educational Codeforces Round 31
- Codeforces Educational Codeforces Round 31
- Codeforces Educational Codeforces Round 31
- Educational Codeforces Round 31
- Educational Codeforces Round 31
- Educational Codeforces Round 31
- Educational Codeforces Round 31
- Educational Codeforces Round 31 题解
- 【CODEFORCES】 Educational Codeforces Round 1
- Codeforces Educational Codeforces Round 5
- Codeforces Educational Codeforces Round 22
- Codeforces Educational Codeforces Round 27
- Codeforces Educational Codeforces Round 27
- Codeforces Educational Codeforces Round 27
- Codeforces Educational Codeforces Round 27
- Educational Codeforces Round 1
- Educational Codeforces Round 2
- MySQL操作表结构
- Reactor5.0源代码混淆器
- git报错-->! [remote rejected] master -> master (push declined due to email privacy restrictions)
- Javaweb项目搭建ehcache缓存系统
- Linux常用命令学习
- Codeforces Educational Codeforces Round 31
- binary-tree-level-order-traversal Java code
- Qt 网络编程-UDP
- 7.Servlet与线程安全
- 罗永浩现身乐视手机发布会,这让人浮想联翩
- 364天后,微信Mac版终于更新
- 取消Hangouts的直播功能,谷歌怎么想的?
- 英特尔的无人机之路,“开源方案提供”是终极目的?
- pickle库起到序列化操作的作用(生成cache文件)----Python数据读取加速技巧