A particular school offers cash rewards to children based on their score history. During an l-day period, a string (scores) is formed, for each child, in the following way: where 0

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please find the question, Code should be on C# language.

A particular school offers cash rewards to children based on their score history.
During an l-day period, a string (scores) is formed, for each child, in the following way:
where 0 <s; sc-1 is the score of the child at the fth day.
If they get 1 for m consecutive days or 0 on more than n occasion(s) then they forfeit their prize.
For a given l, n, m and e, let's call strings for which the child gets his prize prize strings, and denote f(l, n, m, c) the
number of prize strings for these parameters.
For example, with I = 4 (4-day period), n =1, m = 3 and e = 3, it can be verified that f(4,1, 3, 3) = 43 and here are the
different prize strings that can be formed:
21212|2 2212|1 222)0 212|1/2 212|11 212|10 212이12 212이1 21122 21피21
2|1|2|0 2|1|1|2 2|1|1|0 2|1|0|2 2|1|0|1 2|0|2|2 2|0|2|1 2|0|1|2 2|0|1|1 1/2|2|2
12|2|1 12|2|0 1212 12|11 12|110 12012 12이1 11/2|2 11/2|1 1|1/2|0
1피02 11이1 110이2|2 11이2|1 11이1/2 1011 021212 이2|2|1 이2112 이211
이미22 이12|1 이112.
L N
You are given L, N, m and e, what is EE f(l, n, m, c) mod 10° + 7.
=1n=1
Input Format
The only line of each test case contains exactiy four integers separated by single spaces: L, N, mand e
Constraints
•1SNXL< 107
•1smsL
• 2<e< 1014
Output Format
Print the answer modulo 10° +7
Sample Input
4133
Sample Output
73
Explanation
f(4, 1,3, 3) = 43, f(3,1,3,3) = 19, f(2,1, 3, 3) = 8 and f(1,1, 3, 3) = 3. Hence the sum is 73.
Transcribed Image Text:A particular school offers cash rewards to children based on their score history. During an l-day period, a string (scores) is formed, for each child, in the following way: where 0 <s; sc-1 is the score of the child at the fth day. If they get 1 for m consecutive days or 0 on more than n occasion(s) then they forfeit their prize. For a given l, n, m and e, let's call strings for which the child gets his prize prize strings, and denote f(l, n, m, c) the number of prize strings for these parameters. For example, with I = 4 (4-day period), n =1, m = 3 and e = 3, it can be verified that f(4,1, 3, 3) = 43 and here are the different prize strings that can be formed: 21212|2 2212|1 222)0 212|1/2 212|11 212|10 212이12 212이1 21122 21피21 2|1|2|0 2|1|1|2 2|1|1|0 2|1|0|2 2|1|0|1 2|0|2|2 2|0|2|1 2|0|1|2 2|0|1|1 1/2|2|2 12|2|1 12|2|0 1212 12|11 12|110 12012 12이1 11/2|2 11/2|1 1|1/2|0 1피02 11이1 110이2|2 11이2|1 11이1/2 1011 021212 이2|2|1 이2112 이211 이미22 이12|1 이112. L N You are given L, N, m and e, what is EE f(l, n, m, c) mod 10° + 7. =1n=1 Input Format The only line of each test case contains exactiy four integers separated by single spaces: L, N, mand e Constraints •1SNXL< 107 •1smsL • 2<e< 1014 Output Format Print the answer modulo 10° +7 Sample Input 4133 Sample Output 73 Explanation f(4, 1,3, 3) = 43, f(3,1,3,3) = 19, f(2,1, 3, 3) = 8 and f(1,1, 3, 3) = 3. Hence the sum is 73.
Expert Solution
steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY