Question: In a space with dimensions width: , height: , and depth: , boxes are stacked with a width, height, and depth of 1 each (

In a space with dimensions width: , height: , and depth: , boxes are stacked with a width, height, and depth of 1 each (a total of Boxes). Each box is marked either '' or ''. Now, considering all the pairs of coordinates, what is the maximum number of boxes stacked continuously along the -axis marked 'A'?
For illustration, we represent '' as yellow, and '' as blue.
Example) The maximum number of continuously stacked ''s along the Z-axis, which is yellow, corresponds to boxes at coordinate .
The order of inputs for the marks on the boxes is: (red arrow in right figure)(X=0,Y=0,Z=0)->(X=0,Y=1,Z=0)->(X=0,Y=2,Z=0)->(X=1,Y=0,Z=0)->(X=1,Y=1,Z=0)->(X=1,Y=2,Z=0)->...->(X=2,Y=2,Z=0)->(X=0,Y=0,Z=1)->...->(X=2,Y=2,Z=2) The input consists of the dimensions of the space (width, height, depth) and the marks on the boxes given as a string.
Input is provided by using cin , and the result is displayed by using cout in Problem 1. In other words, the text is provided by keyboard typing.
The first line contains three integers X Y Z separated by space
After you receive the input X Y Z , validate the input using the function is_valid .
You have to utilize the function is_valid in the main function. Otherwise, you will receive a deduction of 5 points.
Implement the function is_valid with the following specifications:
The function is_valid receives three arguments X,Y,Z .
It verifies if these values, X Y Z , are within the range of $1= X, Y, Z =10$.
If inputs are valid, return 1. Otherwise, return 0. If inputs X Y Z are invalid, receive an input text X Y Z again until its valid.
If inputs are valid, receive the next inputs (array of characters). If input X Y Z is valid, get an input text whose length is the range of is .
After receiving the input text, validate it.
1. The length of the text equals .
2. Whether the text contains only A or B. If it contains other characters such as C or Q, it is not valid. If the input is invalid, receive the text again, until its valid.
Output Format
Display the maximum number of boxes stacked continuously along the Z-axis marked 'A' by using
cout
In a space with dimensions width: , height: , and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!