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

15102번 - Hopscotch 다국어

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

문제

You’re playing hopscotch! You start at the origin and your goal is to hop to the lattice point (N, N). A hop consists of going from lattice point (x1, y1) to (x2, y2), where x1 < x2 and y1 < y2.

You dislike making small hops though. You’ve decided that for every hop you make between two lattice points, the x-coordinate must increase by at least X and the y-coordinate must increase by at least Y.

Compute the number of distinct paths you can take between (0, 0) and (N, N) that respect the above constraints. Two paths are distinct if there is some lattice point that you visit in one path which you don’t visit in the other.

Hint: The output involves arithmetic mod 109 + 7. Note that with p a prime like 109 + 7, and x an integer not equal to 0 mod p, then x(xp−2) mod p equals 1 mod p.

입력

The input consists of a line of three integers, N X Y. You may assume 1 ≤ X, Y ≤ N ≤ 106.

출력

The number of distinct paths you can take between the two lattice points can be very large. Hence output this number modulo 1 000 000 007 (109 + 7).

제한

예제 입력 1

2 1 1

예제 출력 1

2

예제 입력 2

7 2 3

예제 출력 2

9

힌트

출처

ICPC > Regionals > North America > Mid-Central Regional > 2017 Mid-Central Regional Programming Contest H번

ICPC > Regionals > North America > South Central USA Regional > 2017 South Central USA Regional Programming Contest E번

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

출처

대학교 대회

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

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