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

14989번 - Booming Business 다국어

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

문제

You are an expert in bonsai, the Japanese art of cultivating small trees in small containers. Every year, you win the Bonsai Association’s Pruning Competition (BAPC). With all this talent, it would be a shame not to turn your hobby into your job. Recently, you have rented a small store where you will sell your creations. Now you need to make a window display to draw in customers. Of course, you would like to grow the most impressive tree that will fit the window, but the window is only so tall, and the floor of the display can only bear so much weight. Therefore, you want a tree that is exactly so tall and so heavy that it can fit in your window.

Being an expert, you know that by definition a bonsai tree consists of a single branch, with 0 or more smaller bonsai trees branching off from that branch.

Figure 1: Four distinct examples of bonsai trees.

The height and weight of a bonsai tree can be carefully determined. A tree’s weight is equal to the number of branches that appear in it. The weights of the trees in Figure 1 are 1, 4, 6 and 6, respectively. A tree’s height is equal to the length of the longest chain of branches from the root to the top of the tree. The heights of the trees in Figure 1 are 1, 2, 3 and 3, respectively.

To make the most use of your window, you want to produce a bonsai tree of the precise height and weight that it can support. To get an idea of the number of options available to you, you would like to know how many different trees you could possibly grow for your store. Given a height and a weight, can you determine the number of trees with exactly that height and weight? Because the number may be very large, you may give your answer modulo 1,000,000,007.

입력

A single line containing two integers, h and w, with 1 ≤ h, w ≤ 300.

출력

Output a single line containing a single integer, the number of bonsai trees of height h and weight w, modulo 109 + 7.

제한

예제 입력 1

2 4

예제 출력 1

1

예제 입력 2

3 5

예제 출력 2

7

예제 입력 3

20 50

예제 출력 3

573689752

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2017 Preliminaries B번

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

출처

대학교 대회

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

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