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

13754번 - Mismatched Socks 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB175787248.980%

문제

Fred likes to wear mismatched socks. This sometimes means he has to plan ahead. Suppose his sock drawer has one red, one blue, and two green socks. If he wears the red with the blue, he's stuck with matching green socks. He put together two mismatched pairs if he pairs red with green and then blue with green. Given the contents of his sock drawer, how many pairs of mismatched socks can he put together?

입력

Each input will consist of a single test case. Note that your program may be run multiple times on different inputs. The first line of input contains an integer n (1 ≤ n ≤ 1,000) which is the number of colors of socks in Fred's drawer. Each of the next n lines has an integer k (1 ≤ k ≤ 109 ) which is the number of socks of that color.

출력

Output a single integer indicating the number of pairs of mismatched socks that Fred can make with the contents of his sock drawer.

제한

예제 입력 1

3
1
2
1

예제 출력 1

2

예제 입력 2

5
1
2
1
10
3

예제 출력 2

7

힌트

출처

ICPC > Regionals > North America > Southeast USA Regional > 2016 Southeast USA Regional Programming Contest > Division 2 I번

ICPC > Regionals > North America > Pacific Northwest Regional > 2016 Pacific Northwest Region Programming Contest > Division 2 U번

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

출처

대학교 대회

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

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