Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 You are given an integer N . A string consisting of the lowercase English alphabet is called valld ifand only if each vowel occurs

2
You are given an integer N. A string consisting of the lowercase English alphabet is called valld ifand only if each vowel occurs at most once in the string.
Each vowel is assigned a score which is given by a score array of size 5 where,
score[0] refers to the score of a
score[1] refers to the score of e
score[2] refers to the score of i
score[3] refers to the score of o
score[4] refers to the score of u.
The FUN of a string is defined as the sum of the product of the score of two consecutive vowels and their distance.
Your task is to find the sum of FUN of all possible valid strings of length N and return the ans modulo 10n9+7.
Input Format
The first line contains T denoting the number of test cases. T also Specifies the number of times you have to run the countThemA/I function on a different set of inputs.
For each test case:
The first line contains N denoting the length of the string.
The second line contains 5 space-separated values denoting the scores of the vowels.
Output Format
For each test case, print the total FUN modulo 10nO+7 in a new line.
imple Testcase #0
estcase Input
Copy
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions