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

6844번 - Keep on Truckin’ 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 128 MB23211890.000%

문제

A truck driver is planning to drive along the Trans-Canada highway from Vancouver to St. John’s, a distance of 7000 km, stopping each night at a motel. The driver has been provided with a list of locations of eligible motels, with the respective distance of each motel, measured in km, from the starting point in Vancouver. Some of the motel locations are:

0, 990, 1010, 1970, 2030, 2940, 3060, 3930, 4060, 4970, 5030, 5990, 6010, 7000

but more motel locations may be added just before the trip begins.

Determine if it is possible to complete the journey if:

  1. the trucking company insists that the driver travels a minimum distance of A km per day,
  2. the law sets a maximum distance of B km per day, and
  3. each night, the driver must stay at an eligible motel (from the above list or the additional locations described below).

The driver is interested in different options when making the trip, and you are to write the program to calculate how many different options there are.

For example, if no new motel locations are added, A = 1 and B = 500, then it is impossible to make the trip, i.e., the number of options is 0. If A = 970 and B = 1030 then there is one way to make the trip, but if A = 970 and B = 1040 then there are four ways to make the trip. There are two ways to make the trip if A = 970, B = 1030, and we add one stop at 4960.

입력

The first two lines of the input are the minimum distance A and the maximum distance B (1  A  B  7000), both of which are integers. The third line of the input is an integer N (0  N  20), followed by N lines, each giving the location m of an additional eligible motel (0 < m < 7000). You should note that no two motels are located at the same distance from Vancouver.

출력

Output the number of different ways the driver can choose the motels to make the trip, under the given constraints.

제한

예제 입력 1

1
500
0

예제 출력 1

0

예제 입력 2

970
1030
0

예제 출력 2

1

예제 입력 3

970
1040
0

예제 출력 3

4

예제 입력 4

970
1030
1
4960

예제 출력 4

2

힌트

출처

Olympiad > Canadian Computing Competition & Olympiad > 2007 > CCC 2007 Junior Division 5번

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

출처

대학교 대회

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

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