#abc328b. B - 11/11

B - 11/11

Score : 200200 points

问题描述

AtCoder 王国使用一种年份包含 NN 个月的日历。第 ii 个月 (1iN)(1\leq i\leq N)DiD _ i 天,从第 ii 个月的第 11 天到第 ii 个月的第 DiD _ i 天。

在 AtCoder 的一年中有多少天的日期是“重复数字”?

这里,第 ii 个月的第 jj(1iN,1jDi)(1\leq i\leq N,1\leq j\leq D _ i) 被认为具有重复数字日期,当且仅当 iijj 在十进制表示中所有数字都相同。

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

Problem Statement

AtCoder Kingdom uses a calendar whose year has NN months. Month ii (1iN)(1\leq i\leq N) has DiD _ i days, from day 11 of month ii to day DiD _ i of month ii.

How many days in a year of AtCoder have "repdigits" dates?

Here, day jj of month ii (1iN,1jDi)(1\leq i\leq N,1\leq j\leq D _ i) is said to have a repdigit date if and only if all digits in the decimal notations of ii and jj are the same.

Constraints

  • 1N1001\leq N\leq100
  • 1Di100 (1iN)1\leq D _ i\leq100\ (1\leq i\leq N)
  • All input values are integers.

Input

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

NN

D1D _ 1 D2D _ 2 \ldots DND _ N

Output

Print the answer.

Sample Input 1

12
31 29 31 30 31 30 31 31 30 31 30 31

Sample Output 1

13

In AtCoder Kingdom, the days that have repdigit dates are January 11, January 1111, February 22, February 2222, March 33, April 44, May 55, June 66, July 77, August 88, September 99, November 11, and November 1111, for a total of 1313 days.

Sample Input 2

10
10 1 2 3 4 5 6 7 8 100

Sample Output 2

1

In AtCoder Kingdom, only January 11 has a repdigit date.

Sample Input 3

30
73 8 55 26 97 48 37 47 35 55 5 17 62 2 60 23 99 73 34 75 7 46 82 84 29 41 32 31 52 32

Sample Output 3

15

update @ 2024/3/10 01:52:24