Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please use C Lightning Lili is hearing a loud noise outside her window. Lili knows it is raining hard and lightning must have occurred at

Please use C

Lightning Lili is hearing a loud noise outside her window. Lili knows it is raining hard and lightning must have occurred at that time. The lightning sound lasts for A to B seconds. Other than that it is not lightning. She wants to know how many times the lightning occurs given the information for N seconds duration there is either a sound or not. Format Input The input will consist of several lines of input in testdata.in file. On the first line, there is an integer T - the number of test cases. Each test case will be given 3 integers: N - number of total duration, A - number of minimum lightning duration, and B - number of maximum lightning duration. The next line is a binary string length N where 0 means no sound and 1 means there is a sound. Format Output Output should be expressed in format Case #X: Y - X is the number of the test case, and followed by Y , the number of lightning that occurred. Constraints 1 T 102 1 N 104 1 A B 104 Sample Input (testdata.in) 1 20 3 5 10110011110111111001 Sample Output (standard output) Case #1: 1

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

Database Concepts

Authors: David Kroenke, David J. Auer

3rd Edition

0131986252, 978-0131986251

More Books

Students also viewed these Databases questions