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

Cowlendar

Platinum IV 플래티넘 IV
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

Bessie has woken up on a strange planet. In this planet, there are \(N\)
(\(1\le N\le 10^4\)) months, with \(a_1, \ldots, a_N\) days, respectively
(\(1\leq a_i \leq 4 \cdot 10^9\), all \(a_i\) are integers). In addition, on the
planet, there are also weeks, where each week is \(L\) days, with \(L\) being a
positive integer. Interestingly, Bessie knows the following:

  • For the correct \(L\), each month is at least \(4\) weeks long.
  • For the correct \(L\), there are at most \(3\) distinct values of \(a_i\bmod L\).

Unfortunately, Bessie has forgotten what \(L\) is! Help her by printing the sum of
all possible values of \(L\).

Note that the large size of integers involved in this problem may require the
use of 64-bit integer data types (e.g., a "long long" in C/C++).

Problem credits: Brandon Wang

제약

SCORING

  • Inputs 3-4: \(1 \leq a_i \leq 10^6\)
  • Inputs 5-14: No additional constraints

Problem credits: Brandon Wang

입력 형식

The first line contains a single integer \(N\). The second line contains \(N\)
space-separated integers, \(a_1, \ldots, a_N\).

출력 형식

A single integer, the sum of all possible values of \(L\).

예제 1
입력
12
31 28 31 30 31 30 31 31 30 31 30 31
출력
28
설명

The possible values of \(L\) are 1, 2, 3, 4, 5, 6, and 7. For example, \(L=7\) is
valid because each month is at least length \(4 \cdot 7 = 28\) days long, and each
month is either 0, 2, or 3 mod 7.

예제 2
입력
4
31 35 28 29
출력
23
설명

The possible values of \(L\) are 1, 2, 3, 4, 6, and 7. For example, \(L=6\) is valid
because each month is at least length \(4 \cdot 6 = 24\) days long, and each month
is either 1, 4, or 5 mod 6.

문제 정보

riseoj 작성

출처 올림피아드 > USACO > 2023-2024 > January > Silver

태그

평가 및 의견

Cowlendar

개요
출제자 난이도 Platinum IV 플래티넘 IV 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Cowlendar

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