RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
USACO0436

Daisy Chains

Bronze I 브론즈 I
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Every day, as part of her walk around the farm, Bessie the cow visits her
favorite pasture, which has \(N\) flowers (all colorful daisies) labeled
\(1\ldots N\) lined up in a row \((1\le N \le 100)\). Flower \(i\) has \(p_i\) petals
\((1 \le p_i \le 1000)\).

As a budding photographer, Bessie decides to take several photos of these
flowers. In particular, for every pair of flowers \((i,j)\) satisfying
\(1\le i\le j\le N\), Bessie takes a photo of all flowers from flower \(i\) to
flower \(j\) (including \(i\) and \(j\)).

Bessie later looks at these photos and notices that some of these photos have an
"average flower" -- a flower that has \(P\) petals, where \(P\) is the exact average
number of petals among all flowers in the photo.

How many of Bessie's photos have an average flower?

Problem credits: Nick Wu

제약

Problem credits: Nick Wu

입력 형식

The first line of input contains \(N\). The second line contains \(N\)
space-separated integers \(p_1 \dots p_N\).

출력 형식

Please print out the number of photos that have an average flower.

예제 1
입력
4
1 1 2 3
출력
6
설명

Every picture containing just a single flower contributes to the count (there are
four of these in the example). Also, the \((i,j)\) ranges \((1,2)\) and \((2,4)\) in
this example correspond to pictures that have an average flower.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2020-2021 > December > Bronze

태그

평가 및 의견

Daisy Chains

개요
출제자 난이도 Bronze I 브론즈 I 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Daisy Chains

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8