Logo
(追記) (追記ここまで)

34300번 - New Professor 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB33292492.308%

문제

After successfully defending their PhD, Blake got a job as a professor at CS@Mines. Because this is their first semester teaching, they want to look as sharp as possible. Luckily, they have a large wardrobe full of shirts in $C$ different colors.

Blake decides to wear a different color of shirt each day of the work week (Monday through Friday). Additionally, Blake hates doing laundry, so they only wear a shirt once before throwing it away. (Blake is OK with wearing the same color of shirt on Friday of one week and Monday of the next week.)

Given the number of shirts of each of the $C$ colors, how many days can Blake go before breaking the rule of wearing 5ドル$ different colors of shirts in a single week?

Note that a work week is 5ドル$ days (Monday, Tuesday, Wednesday, Thursday, Friday) and it is ok to wear the same color on Friday of a week and Monday of next consecutive week.

입력

The first line of input is a single integer 1ドル \leq C \leq 500$ representing the number of colors.

Each of the next $C$ lines contain an integer 1ドル \leq S_i \leq 500$ representing the number of shirts that Blake has of the $i^{\text{th}}$ unique color.

출력

Your output should be a single line, containing a single integer, the number of days that Blake can wear a different shirt before repeating themself.

제한

예제 입력 1

3
4
4
3

예제 출력 1

3

예제 입력 2

6
4
2
2
2
2
3

예제 출력 2

14

예제 입력 3

5
3
3
4
3
2

예제 출력 3

14

힌트

출처

School > CS@Mines > CS@Mines HSPC 2024 D번

  • 문제를 만든 사람: Mete Saka
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /