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

26331번 - Gold Rush 다국어

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

문제

After learning about the gold rush in school, your friends have decided to have a gold mining tournament. This one-of-a-kind tournament will be the largest of its kind!

For the tournament, everyone will all line up in a row. Every pair of consecutive people will then face off in a "round" of the tournament. Assuming there are 7 people in the tournament, the first round would look something like this when pairing off: (1, 2) (3, 4) (5, 6) (7).

Notice that when there are an odd number of people in a round, the last person automatically advances to the next round. The remaining players in that round play a best-of-k format where k is an odd number of games. The first person to win ceiling(k/2) games advances to the next round, the other player is eliminated from the tournament, and no more games are played between those players.

For example, let's say players 2, 3, 5, and 7 advance from the first round above. The following round then pairs off in order and the match ups look like this: (2, 3) (5, 7).

The rounds continue in this fashion until a single player remains, the tournament winner!

You would like to know, for a given tournament layout, how many ways the tournament records can play out. Two tournament records are considered different if one of the following conditions is met:

  1. The number of games played by a player in the tournament is different.
  2. The outcome of the i-th game played by a player is different.

Given the number of players in a tournament and its format (as in best-of-k), determine the number of possible win-loss records.

입력

The input begins with a single positive integer, t, representing the number of tournaments to evaluate. Each of the next t lines contains two integers, n (1 ≤ n ≤ 1017) and k (1 ≤ k ≤ 1017), representing the number of players and the best-of-k format, respectively.

출력

For each tournament, output the number of possible win-loss records. As this number may be quite large, output the result modulo 1,000,003.

제한

예제 입력 1

2
2 7
3 1

예제 출력 1

70
4

힌트

출처

University > University of Central Florida > 2013 Local Programming Contest 6번

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

출처

대학교 대회

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

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