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

15518번 - Window 다국어

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

문제

In the building of Jewelry Art Gallery (JAG), there is a long corridor in the east-west direction. There is a window on the north side of the corridor, and N windowpanes are attached to this window. The width of each windowpane is W, and the height is H. The i-th windowpane from the west covers the horizontal range between W × (i - 1) and W × i from the west edge of the window.

Figure A1. Illustration of the window

You received instructions from the manager of JAG about how to slide the windowpanes. These instructions consist of N integers x1, x2, ..., xN, and xiW is satisfied for all i. For the i-th windowpane, if i is odd, you have to slide i-th windowpane to the east by xi, otherwise, you have to slide i-th windowpane to the west by xi.

You can assume that the windowpanes will not collide each other even if you slide windowpanes according to the instructions. In more detail, N windowpanes are alternately mounted on two rails. That is, the i-th windowpane is attached to the inner rail of the building if i is odd, otherwise, it is attached to the outer rail of the building.

Before you execute the instructions, you decide to obtain the area where the window is open after the instructions.

입력

The input consists of a single test case in the format below.

N H W
x1 ... xN

The first line consists of three integers N, H, and W (1 ≤ N ≤ 100, 1 ≤ H, W ≤ 100). It is guaranteed that N is even. The following line consists of N integers x1, ..., xN while represent the instructions from the manager of JAG. xi represents the distance to slide the i-th windowpane (0 ≤ xiW).

출력

Print the area where the window is open after the instructions in one line.

제한

예제 입력 1

4 3 3
1 1 2 3

예제 출력 1

9

예제 입력 2

8 10 18
2 12 16 14 18 4 17 16

예제 출력 2

370

예제 입력 3

6 2 2
0 2 2 2 2 0

예제 출력 3

8

예제 입력 4

4 1 4
3 3 2 2

예제 출력 4

6

예제 입력 5

8 7 15
5 0 9 14 0 4 4 15

예제 출력 5

189

힌트

Figure A2. Illustration of Sample Input 1

출처

Contest > ICPC Japanese Alumni Group > JAG Practice Contest for ICPC Asia Regional > JAG Practice Contest for ACM-ICPC Asia Regional 2017 A번

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

출처

대학교 대회

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

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