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

29911번 - Dividing apples 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB95644963.636%

문제

$N$ baskets are lined up, numbered 1ドル \ldots N$ from left to right. The basket number $i$ contains $K_i$ apples. John and Mary want to draw a line between two baskets, and then John would get all the baskets to the left of the line and Mary all the baskets to the right of the line. Help them draw the line to divide the apples as equally as possible!

입력

The first line of input contains $N,ドル the number of baskets (2ドル \le N \le 1,000円,000円$). Each of the following $N$ lines contains an integer $K_i$: the number of apples in basket number $i$ (1ドル \le i \le N,ドル 0ドル \le K_i \le 10,000円$).

출력

The only line of output should contain a single integer: the number of the basket to the right of which the line should be drawn, so that the absolute value of the difference between the number of apples John gets, and the number of apples Mary gets, would be as small as possible. If there are multiple possible answers, output any one of them.

제한

예제 입력 1

7
4
2
10
2
9
3
7

예제 출력 1

4

When the line is drawn between the fourth and the fifth basket, John gets 4ドル+2+10+2=18$ apples and Mary gets 9ドル+3+7=19$ apples. The difference between these numbers is 1ドル,ドル which is the smallest possible.

힌트

출처

Olympiad > Estonian Informatics Olympiad > 2019-20 > Open Competition 1번

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

출처

대학교 대회

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

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