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

10622번 - A Population of Rabbits 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 256 MB2210969.231%

문제

A hypothetical population of rabbits follows certain fixed rules.

  1. The population begins in the first month with a pair of newborn rabbits.
  2. Rabbits reach reproductive age in one month.
  3. In any month, every rabbit of reproductive age mates with another rabbit of reproductive age.
  4. One month after two rabbits have mated, the female rabbit gives birth to a male and female rabbit.
  5. Rabbits die after a given age of D months and not reproducing after R months where R ≤ D.

In the figure on the right, a depiction of a rabbit tree is shown in which rabbits live for three months (meaning that they reproduce only twice before dying). The life of a particular rabbit pair is shown with solid arrows. For example the initial pair starts their life in Month 1, mates in month 2 and a new pair is born in month 3 as a result (the dotted arrow). The original pair mates again in month 3, and a new pair is born in month 4 (dotted arrow). However the original pair dies in month 4 right after giving birth and is therefore not shown in the population of month 4.

입력

The input consists of multiple test cases. The first line of input is the number of test cases N (1≤N≤100). Each of the following N lines contains positive integers D≤100, R≤100, and M≤20 where D is the number of months after which a rabbit dies, R is the number of month after which a rabbit stops reproducing, and M is the number of months to model.

출력

For each test case, print a single line saying “Case #n:” where n is the test case number followed by a space followed the total number of rabbit pairs that will remain after M months.

제한

예제 입력 1

2
3 3 6
3 3 3

예제 출력 1

Case #1: 4
Case #2: 2

힌트

출처

ICPC > Regionals > Asia West Continent > Pakistan > Asia Lahore Regional 2014 7번

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

출처

대학교 대회

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

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