Question: The sequence is disturbed. ( NoisySequence ) Semester 2 , academic year 2 0 2 2 , Thammasat University, by Faculty of Science and Technology
The sequence is disturbed. NoisySequence
Semester academic year Thammasat University, by Faculty of Science and Technology
A special signal scooping tool is able to cut every captured signal from the time the machine is turned on until the machine is turned off by the correct signal.
Measurements can be expressed as numbers, such as
SIGNAL:
Two programmers were practicing sending psychic energy to each other and used a special measuring device to measure their psychic energy. By the period of the psychic energy wave that The two programmers are sending each other integers in descending order, starting from A through B If the psychic range is set,
A and B it will be found that the psychic energy range is and If we consider the signal from the example above, we will also find the psychic energy wave as well.
SIGNAL:
Not sorted correctly in the range A to B
But during such psychic energy there are noises and because and
As specified by the range of psychic powers
Specify that the sequence of numbers be arranged in ascending order from A to which is the sequence in the psychic energy wave that may be separated by noise but such sequence must still be arranged in ascending order by Determining the psychic range from the waves that a special instrument can measure will count the values A and B that are found fastest in sequence. The problem asks students to write a program to calculate the sum of the noise in the psychic range A and B but if found that the psychic energy wave Arrangements that do not reach B are considered to be unable to detect the psychic wave. Instead, display the ordinal value of the highest psychic power detected.
example
SIGNAL:
SIGNAL;
Given N A and B
The sum of the noise signals of SIGNAL is equal to
SIGNAL:
SIGNAL:
Given N A and B
Psychic waves cannot be detected in SIGNAL The highest possible sequence is
input data
The input has lines.
Line : Get three integer values separated by spaces. N is the number of numbers measured by the special instrument. A and B are the psychic range, where N and A B
Line Integer Number of steps with spaces. represents each numerical value that the instrument measures The measured value will be in the range to
Note: Set every input data to always have the correct value according to the format, range, and range of possible values. Students do not need to validate their input.
Export data
The output data has line representing the sum of the noise in the case of a psychic wave detected and shows the sequence with the largest possible value if No psychic waves detected In case the starting point or A value is not found in the sequence, will be displayed on the screen.
Example
input data
Export data
Example
input data
Export data
input data
Export data
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
