Pro.ID21647 TitleSpeed Reading Title链接http://10.20.2.8/oj/exercise/problem?problem_id=21647 AC0 Submit0 Ratio- 时间&空间限制描述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. Cowihas 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 of Sipages per minute, but only for Timinutes at a time. After she stops reading to rest, she must rest for Riminutes 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. 输入* 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 输出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. Cowihas 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 of Sipages per minute, but only for Timinutes at a time. After she stops reading to rest, she must rest for Riminutes 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 Sample Output 6 Source 样例输入10 3 样例输出6 作者 |