Counting cool words

In this problems, we say that a word is cool if it does not have two
consecutive consonants. Write a program to compute how many words with n
lowercase letters, v of which are vowels, are cool.

For instance, these are some of the many cool words for n = 5 and v = 3:

aabab ababa babaa toiep zeyui

Remember that there are 5 vowels and 21 consonants.

Input

Input consists of several cases, each with two natural numbers
1 ≤ n ≤ 15 and 0 ≤ v ≤ n.

Output

For every case, print the number of cool words with n lowercase letters,
v of which are vowels. This number is always smaller than 10¹⁸.

Problem information

Author: Unknown
Translator: Salvador Roura

Generation: 2026-01-25T11:33:52.892Z

© Jutge.org, 2006–2026.
https://jutge.org
