CF139A.Petr and Book
入门
通过率:0%
时间限制:2.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
One Sunday Petr went to a bookshop and bought a new book on sports programming. The book had exactly n pages.
Petr decided to start reading it starting from the next day, that is, from Monday. Petr's got a very tight schedule and for each day of the week he knows how many pages he will be able to read on that day. Some days are so busy that Petr will have no time to read whatsoever. However, we know that he will be able to read at least one page a week.
Assuming that Petr will not skip days and will read as much as he can every day, determine on which day of the week he will read the last page of the book.
某个周日,彼得去书店买了一本关于体育编程的新书。这本书恰好有 n 页。
彼得决定从第二天(即周一)开始阅读这本书。彼得的日程非常紧张,他已知每周每一天最多能读多少页。有些日子实在太忙,以至于彼得完全没时间读书。但我们知道,他每周至少能读一页。
假设彼得不会跳过任何一天,并且每天都会尽其所能地阅读,试确定他将在星期几读完这本书的最后一页。
输入格式
The first input line contains the single integer n (1 ≤ n ≤ 1000) — the number of pages in the book.
The second line contains seven non-negative space-separated integers that do not exceed 1000 — those integers represent how many pages Petr can read on Monday, Tuesday, Wednesday, Thursday, Friday, Saturday and Sunday correspondingly. It is guaranteed that at least one of those numbers is larger than zero.
第一行输入包含一个整数 n(1≤n≤1000)——表示书的页数。
第二行包含七个非负整数,以空格分隔,每个数均不超过 1000 —— 这些整数分别表示彼得在周一、周二、周三、周四、周五、周六和周日所能阅读的页数。保证其中至少有一个数大于零。
输出格式
Print a single number — the number of the day of the week, when Petr will finish reading the book. The days of the week are numbered starting with one in the natural order: Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday.
输出一个数字——即彼得读完这本书时所在星期的日期编号。星期的编号按自然顺序从 1 开始:周一、周二、周三、周四、周五、周六、周日。
输入输出样例
输入#1
100 15 20 20 15 10 30 45
输出#1
6
输入#2
2 1 0 0 0 0 0 0
输出#2
1
说明/提示
Note to the first sample:
By the end of Monday and therefore, by the beginning of Tuesday Petr has 85 pages left. He has 65 pages left by Wednesday, 45 by Thursday, 30 by Friday, 20 by Saturday and on Saturday Petr finishes reading the book (and he also has time to read 10 pages of something else).
Note to the second sample:
On Monday of the first week Petr will read the first page. On Monday of the second week Petr will read the second page and will finish reading the book.
第一个样例说明:
到周一结束时(即周二开始时),Petr 还剩 85 页未读;到周三开始时还剩 65 页;到周四开始时还剩 45 页;到周五开始时还剩 30 页;到周六开始时还剩 20 页;而 Petr 在周六当天读完了整本书(并且还有时间额外阅读了 10 页其他内容)。
第二个样例说明:
第一周的周一,Petr 将阅读第 1 页;第二周的周一,Petr 将阅读第 2 页,并在此时读完这本书。
输入解题思路,AI测评打分。不知道怎么写?