#abc315b. B - The Middle Day

B - The Middle Day

Score : 200200 points

问题描述

在 AtCoderLand 的日历中,一年包含 MM 个月:第 1 月、第 2 月、……、第 MM 月。第 ii 个月包含了 DiD_i 天:第 1 天、第 2 天、……、第 DiD_i 天。

此外,一年中的天数是奇数,即 D1+D2++DMD_1+D_2+\dots+D_M 是奇数。

找出一年中位于正中间的日期是哪个月份的哪一天。 换句话说,将第 1 个月的第 1 天视为一年中的第一天,求出 aabb,使得一年中的第 (D1+D2++DM+12)\left(\frac{D_1+D_2+\dots+D_M+1}{2}\right) 天是第 aa 个月的第 bb 天。

以上为通义千问 qwen-max 翻译,仅供参考。

Problem Statement

In the calendar of AtCoderLand, a year consists of MM months: month 11, month 22, \dots, month MM. The ii-th month consists of DiD_i days: day 11, day 22, \dots, day DiD_i.
Furthermore, the number of days in a year is odd, that is, D1+D2++DMD_1+D_2+\dots+D_M is odd.
Find what day of what month is the middle day of the year.
In other words, let day 11 of month 11 be the first day, and find aa and bb such that the ((D1+D2++DM+1)/2)((D_1+D_2+\dots+D_M+1)/2)-th day is day bb of month aa.

Constraints

  • All input values are integers.
  • 1M1001 \le M \le 100
  • 1Di1001 \le D_i \le 100
  • D1+D2++DMD_1 + D_2 + \dots + D_M is odd.

Input

The input is given from Standard Input in the following format:

MM

D1D_1 D2D_2 \dots DMD_M

Output

Let the answer be day bb of month aa, and print it in the following format:

aa bb

Sample Input 1

12
31 28 31 30 31 30 31 31 30 31 30 31

Sample Output 1

7 2

In this input, a year consists of 31+28+31+30+31+30+31+31+30+31+30+31=36531+28+31+30+31+30+31+31+30+31+30+31=365 days.
Let us find the middle day, which is the ((365+1)/2=183)((365+1)/2 = 183)-th day.

  • Months 1,2,3,4,5,61,2,3,4,5,6 contain a total of 181181 days.
  • Day 11 of month 77 is the 182182-th day.
  • Day 22 of month 77 is the 183183-th day.

Thus, the answer is day 22 of month 77.

Sample Input 2

1
1

Sample Output 2

1 1

Sample Input 3

6
3 1 4 1 5 9

Sample Output 3

5 3

update @ 2024/3/10 09:00:20