Problem Description

All K (1 ≤ K ≤ 1,000) of the cows are participating in Farmer John's annual reading contest. The competition consists of reading a single book with N (1 ≤ N ≤ 100,000) pages as fast as possible while understanding it.

Cow i has a reading speed Si (1 ≤ Si ≤ 100) pages per minute, a maximum consecutive reading time Ti (1 ≤ Ti ≤ 100) minutes, and a minimum rest time Ri (1 ≤ Ri ≤ 100) minutes. The cow can read at a rate ofSi pages per minute, but only for Ti minutes at a time. After she stops reading to rest, she must rest for Ri minutes before commencing reading again.

Determine the number of minutes (rounded up to the nearest full minute) that it will take for each cow to read the book.

Input

Line 1: Two space-separated integers: N and K

Lines 2..K+1: Line i+1 contains three space-separated integers: Si , Ti , and Ri

Output

Lines 1...K: Line i should indicate how many minutes (rounded up to the nearest full minute) are required for cow i to read the whole book.

Sample Input

10 3

2 4 1
6 1 5
3 3 3

Sample Output

6
7
7

题意:一本书,页数为n,每秒读s页,可连读t秒,但读t秒后需休息r秒,求读完书所需时间。

思路:水题一枚,读的懂题就行。。。

Source Program

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<string>
#include<cstdlib>
#include<queue>
#include<vector>
#define INF 0x3f3f3f3f
#define PI acos(-1.0)
#define N 100001
#define MOD 2520
#define E 1e-12
using namespace std;
int main()
{int n,k;scanf("%d%d",&n,&k);for(int i=0;i<k;i++){int s,t,r;scanf("%d%d%d",&s,&t,&r);int num=n;//未读页数int time=0;//用时while(num>s*t)//当未读页数>连读t秒的页数时{time+=t+r;//总时间=读书时间+休息时间num-=s*t;//未读页数=原页数-已读页数}/*处理未计算页数*/time+=num/s;if(num%s)time++;cout<<time<<endl;}return 0;
}

Speed Reading(POJ-3619 )相关推荐

  1. Bailian2734 十进制到八进制【入门】(POJ NOI0113-45)

    问题链接:POJ NOI0113-45十进制到八进制 2734:十进制到八进制 总时间限制: 1000ms 内存限制: 65536kB 描述 把一个十进制正整数转化成八进制. 输入 一行,仅含一个十进 ...

  2. Bailian2676 整数的个数【入门】(POJ NOI0105-11)

    问题链接:POJ NOI0105-11 整数的个数 2676:整数的个数 总时间限制: 1000ms 内存限制: 65536kB 描述 给定k(1 < k < 100)个正整数,其中每个数 ...

  3. Bailian4029 数字反转【进制】(POJ NOI0105-29)

    问题链接:POJ NOI0105-29 数字反转 4029:数字反转 总时间限制: 1000ms 内存限制: 65535kB 描述 给定一个整数,请将该数各个位上数字反转得到一个新数.新数也应满足整数 ...

  4. Bailian2735 八进制到十进制【入门】(POJ NOI0113-46)

    问题链接:POJ NOI0113-46 八进制到十进制 2735:八进制到十进制 总时间限制: 1000ms 内存限制: 65536kB 描述 把一个八进制正整数转化成十进制. 输入 一行,仅含一个八 ...

  5. Silver Cow Party (POJ - 3268 )

    Silver Cow Party (POJ - 3268 ) 这道题是我做的最短路专题里的一道题,但我还没做这个,结果比赛就出了,真是.......... 题目: One cow from each ...

  6. 吴昊品游戏核心算法 Round 7 —— 熄灯游戏AI(有人性的Brute Force)(POJ 2811)

    暴力分为两种,一种属于毫无人性的暴力,一种属于有人性 的暴力.前面一种就不说了,对于后面一种情况,我们可以只对其中的部分问题进行枚举,而通过这些子问题而推导到整个的问题中.我称之为有人性的Brute ...

  7. 【二分】Best Cow Fences(poj 2018)

    Best Cow Fences poj 2018 题目大意: 给出一个正整数数列,要你求平均数最大,长度不小于M的字串,结果乘1000取整 输入样例 10 6 6 4 2 10 3 8 5 9 4 1 ...

  8. 昂贵的聘礼(poj 1062)

    Description 年轻的探险家来到了一个印第安部落里.在那里他和酋长的女儿相爱了,于是便向酋长去求亲.酋长要他用10000个金币作为聘礼才答应把女儿嫁给他.探险家拿不出这么多金币,便请求酋长降低 ...

  9. 主席树学习小结(POJ 2104)

    在高中的时候就听到过主席树了,感觉非常高端,在寒假的时候 winter homework中有一题是查找区间第K大的树,当时就开始百度这种网上的博客,发现主席树看不懂,因为那个root[i],还有tx[ ...

  10. A - TOYS(POJ - 2318) 计算几何的一道基础题

    Calculate the number of toys that land in each bin of a partitioned toy box. 计算每一个玩具箱里面玩具的数量 Mom and ...

最新文章

  1. 数字电路技术基础一二章
  2. sklearn逻辑回归 极大似然 损失_收藏!攻克目标检测难点秘籍二,非极大值抑制与回归损失优化之路...
  3. 物流英语与计算机操作,《物流英语与计算机模拟题及正确答案.doc
  4. product sales data determination in Opportunity item
  5. Nginx(五):动静分离
  6. python将列表中反序输出_python中sorted怎么反序排列
  7. 信息学奥赛一本通C++语言——1046:判断一个数能否同时被3和5整除
  8. 传智php入学测试题,传智播客PHP 0912 基础班 入学测试题
  9. JS正则表达式详解2
  10. 干什么事都要先定位,再聚焦
  11. 计算机英语900句.pdf,计算机英语900句第一章第一课:概貌
  12. js控制隐藏或显示table的某一行
  13. NOIP2012 提高组 Day 2
  14. python中的目录简介_Python程序设计(第3版)董付国作者介绍、内容简介、图书详情、目录...
  15. 笔记本电脑用久了卡顿解决方法
  16. openvino只支持英特尔6代以上的cpu
  17. Gedit 有用插件介绍
  18. C# PrintDocument 打印 和 打印预览
  19. 9700 功耗测试软件,测试平台与说明 - 酷睿i9-9900K/i7-9700K同步评测:八核的时代来了 - 超能网...
  20. mysql导出表数据到文件的几种方法

热门文章

  1. 让AI学习AI:自动化机器学习的概述、发展和研究意义
  2. python提取字符串中数字_EXCEL数字在字符串中间怎么提取?
  3. IDEA 2020年最后一个版本更新了,机器学习都整上了
  4. 用内卷搞垮团队!您可真行
  5. 2016年度最受欢迎开源项目,JEECG、JEEWX参与投票
  6. Windows平台下安装证书文件cer的步骤
  7. Phase retrieval交替投影
  8. 再问数据中台 - 数据中台里的数据质量应该如何保障?
  9. MyBatis 实践 -Mapper与DAO
  10. Linux进程实践(5) --守护进程