QOJ.ac

QOJ

Süre Sınırı: 2 s Bellek Sınırı: 256 MB Toplam puan: 100

#20978. デイジーチェーン

İstatistikler

牛の Bessie は毎日、農場を散歩するときにお気に入りの牧草地を訪れます。そこには $1\ldots N$ と番号の付いた $N$ 本の花(すべて色鮮やかなデイジー)が一列に並んでいます($1\le N \le 100$)。花 $i$ の花びらは $p_i$ 枚です($1 \le p_i \le 1000$)。

駆け出しの写真家 Bessie は、この花々の写真を何枚か撮ることにしました。具体的には、$1\le i\le j\le N$ を満たすすべての花の組 $(i,j)$ について、花 $i$ から花 $j$ までのすべての花($i$ と $j$ を含む)を撮影します。

後で写真を見た Bessie は、一部の写真に「平均の花」があると気付きました。これは花びらが $P$ 枚ある花で、$P$ は写真内のすべての花の花びらの枚数の正確な平均です。

Bessie の写真のうち、平均の花があるものは何枚でしょうか?

入力

入力の最初の行には $N$ が与えられます。2 行目には空白区切りの $N$ 個の整数 $p_1 \dots p_N$ が与えられます。

出力

平均の花がある写真の枚数を出力してください。

入出力例

入力 1

4
1 1 2 3

出力 1

6

注記

花が 1 本だけの写真はすべて数えます(この例では 4 枚あります)。また、この例の $(i,j)$ の区間 $(1,2)$ と $(2,4)$ の写真にも平均の花があります。

問題作成:Nick Wu

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.