题目描述:
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 86400
0 86400
输出:
2
1
题意:
一个人要完成一件事总共需要t秒,现在有n天,每天有ai不能做事,问他可以在第几天做完。
题解
暴力。
代码:

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
using namespace std;int main(){int n,k;int a[105];while(scanf("%d%d",&n,&k)!=EOF){int sum = 0;int cnt = 0;for(int i = 1; i <= n; i ++){scanf("%d",&a[i]);}for(int i = 1; i <= n; i ++){sum = sum + 86400 - a[i];cnt ++;if(sum >= k){break;}}printf("%d\n",cnt);}return 0;
}

Codeforces--884A--Book Reading相关推荐

  1. Codeforces 题目合集+分类+代码 【Updating...】【361 in total】

    961A - Tetris                                                模拟                                      ...

  2. Codeforces Round #653 (Div. 3)(A, B, C, D, E1详解)

    Codeforces Round #653 (Div. 3) Required Remainder Thinking(binary search) 既然是找最大值问题,我又懒得去推式子,于是我直接就上 ...

  3. Codeforces Round 546 (Div. 2)

    layout: post title: Codeforces Round 546 (Div. 2) author: "luowentaoaa" catalog: true tags ...

  4. Codeforces Round #Pi (Div. 2) B. Berland National Library 模拟

    B. Berland National Library Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/conte ...

  5. 矩阵快速幂2Jzzhu and Sequences Recurrences Contemplation! Algebra Reading comprehension

    来!接着写题解,立个flag:矩阵快速幂题解不写完今晚不睡觉! 此题解是接着矩阵快速幂1写的,此篇有哪里写不清楚的地方导致看不懂的可以先看1:https://blog.csdn.net/qq_4536 ...

  6. CodeForces 375D Tree and Queries

    传送门:https://codeforces.com/problemset/problem/375/D 题意: 给你一颗有根树,树上每个节点都有其对应的颜色,有m次询问,每次问你以点v为父节点的子树内 ...

  7. 「日常训练」Bad Luck Island(Codeforces Round 301 Div.2 D)

    题意与分析(CodeForces 540D) 是一道概率dp题. 不过我没把它当dp做... 我就是凭着概率的直觉写的,还好这题不算难. 这题的重点在于考虑概率:他们喜相逢的概率是多少?考虑超几何分布 ...

  8. 【codeforces 812C】Sagheer and Nubian Market

    [题目链接]:http://codeforces.com/contest/812/problem/C [题意] 给你n个物品; 你可以选购k个物品;则 每个物品有一个基础价值; 然后还有一个附加价值; ...

  9. CodeForces 获得数据

    针对程序的输出可以看见 CodeForces :当输入.输出超过一定字符,会隐藏内容 所以:分若干个程序进行输入数据的获取 1. 1 for (i=1;i<=q;i++) 2 { 3 scanf ...

  10. codeforces水题100道 第二十七题 Codeforces Round #172 (Div. 2) A. Word Capitalization (strings)...

    题目链接:http://www.codeforces.com/problemset/problem/281/A 题意:将一个英文字母的首字母变成大写,然后输出. C++代码: #include < ...

最新文章

  1. php mongodb execute,php简单操作mongodb
  2. 协同过滤算法 R/mapreduce/spark mllib多语言实现
  3. 【视频】测试经理必修课
  4. 几个关于财报的基本知识
  5. Python的系统管理_12_rrdtool
  6. Eclipse里不同的project,右键选择属性property facet里看到的list 内容是否相同
  7. 集合框架中的接口及其实现类
  8. mysql断网_断网的情况上如何访问本机的mysql
  9. oracle定义变量sql赋值_ORACLE获取SQL绑定变量值的方法总结
  10. C++/OpenCV:Error: Assertion failed ((unsigned)i0 < (unsigned)(size.p[0] * size.p[1]))
  11. HashTable数据类型的增删改查操作0404
  12. ICCV 2019 VisDrone挑战赛冠军方案解读
  13. 2021牛客暑期多校训练营7,签到题FHI
  14. 【原】对txt文本进行数据读取
  15. pta 7-5 病毒变种 C语言
  16. java 读音_数的读法 (Java代码)
  17. 模糊c–均值聚类算法的原理解释及推导
  18. 新一代HTAP数据库崛起,MySQL生态的最佳归宿?
  19. 高等代数---欧几里得空间
  20. IDC:中国云计算市场超10亿 企业云火热

热门文章

  1. 连载:面向对象葵花宝典:思想、技巧与实践(27) - 动态模型设计
  2. 【转】理解分布式账本技术: 经济学视角
  3. 手机wifi服务器文件途径,查看手机wifi服务器dns地址
  4. c语言音频信号频谱分析,音频信号频谱分析(正文)-副本.pdf
  5. 给技术经理找了几款Docker开源镜像仓库,为什么经理选中了Sonatype Nexus(下)
  6. Android MVP详解
  7. Ios android crash report,iOS App 后台 Crash 调查
  8. 泛克里金方法的实际应用——小试牛刀
  9. Python画好看的星空图
  10. LZW编码算法原理及实例应用