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

Težina

설명

Strong Karlo is in the gym. An array \(a\) of \(n\) numbers is given, where each number
represents the weight of one item in front of Karlo. An integer \(k\) is also given,
representing the number of different weights Karlo can use.
For each weight type from 1 to \(k\) and for each item in the array, Karlo does the
following:
1. Divide the item’s weight by the weight type and record the integer part
of the division (discard the fractional part).
2. Multiply the obtained integer by the item’s weight increased by 2. If the
resulting number is greater than \(10^{8}\), Karlo replaces it with \(10^{8}\).
3. Sum all obtained numbers for that weight type. The obtained sum is called
the strength of that weight type.
Karlo is interested in the sum of strengths of all weight types in the gym. Since Karlo does not have time
to calculate it, help him solve his problem.

제약
입력 형식

The first line contains the natural numbers \(n\) and \(k\) (\(1 \le n\), \(k \le 10^{5}\)), the number of items in front of
Karlo and the number of weight types Karlo can use.
The second line contains an array of \(n\) numbers (\(1 \le a_{i} \le 10^{5}\)), the weights of the items in front of Karlo.

출력 형식

Print a single number, the answer to the question from the problem statement.

서브태스크
서브태스크점수설명

1

17점

\(k \le 300\)

2

19점

The array \(a\) will contain at most 300 distinct values.

3

34점

No additional constraints.

예제 1
입력
1 2
2
출력
12
예제 2
입력
2 1
3 4
출력
39
예제 3
입력
7 19
1 2 3 4 5 6 7
출력
414
설명

Clarification of the second sample test: Karlo will transform the number 3 into 3 · 5 = 15, and the
number 4 into 4 · 6 = 24. Their sum equals 39.

문제 정보

생성자가 기록되지 않았습니다.

출처 COCI 2025/2026 Contest 5

평가 및 의견

Težina

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 50 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

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

풀이 제출

Težina

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