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

27041번 - Leapcow 다국어

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

문제

Like everyone else, the cows like to bury each other in sand while at the beach. On this beach, the cows are only buried on the integer coordinates of a one-dimensional number line. Bessie wants to travel from one end of the beach (i.e., coordinate 0) to the other end (coordinate E, 5 ≤ E ≤ 40,000) without stepping on any buried cows. Bessie travels only by leaps, each of which has some length in the range 1..L (3 ≤ L ≤ 50).

Given the locations (1..E-1) of the B (1 ≤ B ≤ 500) buried cows, figure out the least number of leaps Bessie can use to get from one side to the other. It is guaranteed that an answer exists.

입력

  • Line 1: Three space-separated integers: E, L, and B.
  • Lines 2..B+1: Each line contains a single integer telling the coordinate of a buried cow.

출력

A single line with an integer that is the smallest number of "legal" leaps that are required for Bessie to reach coordinate E.

제한

예제 입력 1

5 3 2
2
3

예제 출력 1

3

힌트

A single line with an integer that is the smallest number of "legal" leaps that are required for Bessie to reach coordinate E.

Here's a diagram of the beach and leaps:

# # c c # # <--- cow denoted by 'c'
0 1 2 3 4 5 <--- location numbers
 1 2 3 <--- where leaps 1, 2, and 3 end

출처

Olympiad > USA Computing Olympiad > 2003-2004 Season > USACO December 2003 Contest > Orange 3번

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

출처

대학교 대회

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

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