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

12037번 - Polynesiaglot (Small1) 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 512 MB26821518880.000%

문제

Ursula is a big fan of constructing artificial languages. Today, she is starting to work on a language inspired by real Polynesian languages. The only rules she has established are:

  • All words consist of letters. Letters are either consonants or vowels.
  • Any consonant in a word must be immediately followed by a vowel.

For example, in a language in which a is the only vowel and h is the only consonant, a, aa, aha, aaha, and haha are valid words, whereas h, ahh, ahah, and ahha are not. Note that the rule about consonants disallows ending a word in a consonant as well as following a consonant with another consonant.

If Ursula's new language has C different consonants and V different vowels available to use, then how many different valid words of length L are there in her language? Since the output can be a really big number, we only ask you to output the remainder of dividing the result by the prime 109+7 (1000000007).

입력

The first line of the input gives the number of test cases, T. T test cases follow. Each consists of one line with three integers C, V, and L.

Limits

  • T = 15.
  • C = 1.
  • V = 1.
  • 1 ≤ L ≤ 15.

출력

For each test case, output one line containing Case #x: y, where x is the test case number (starting from 1) and y is the number of different valid words of length L in the language, modulo the prime 109+7 (1000000007).

제한

예제 입력 1

2
1 1 4
1 2 2

예제 출력 1

Case #1: 5
Case #2: 6

힌트

In Case #1, suppose that the only vowel is a and the only consonant is h. Then the possible valid words of length 4 are: aaaa, aaha, ahaa, haaa, haha.

In Case #2 (which would not appear in the Small dataset 1), suppose that the two vowels are a and e and the only consonant is h. Then the possible valid words of length 2 are: aa, ae, ea, ee, ha, he.

출처

Contest > Google > Code Jam to I/O for Women > Code Jam to I/O for Women 2016 > Code Jam to I/O for Women 2016 C1번

채점 및 기타 정보

  • 예제는 채점하지 않는다.
(追記) (追記ここまで)

출처

대학교 대회

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

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