Question: use java The sequence is disturbed. ( NoisySequence ) Semester 2 , academic year 2 0 2 2 , Thammasat University, by Faculty of Science

use java
The sequence is disturbed. (NoisySequence)
Semester 2, academic year 2022, Thammasat University, by Faculty of Science and Technology 300
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-1: 241211917565121377
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 =5 and B =7, it will be found that the psychic energy range is 5,6, and 7. If we consider the signal from the example above, we will also find the psychic energy wave as well.
SIGNAL-1: 241211917565121377
Not sorted correctly in the range A to B
But during such psychic energy there are noises 5,12 and 13 because 12 and
As specified by the range of psychic powers
Specify that the sequence of numbers be arranged in ascending order from A to 8, 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-1: 241211917565121377
SIGNAL-1; 241211917565121377
Given N =13, A =5 and B =7.
The sum of the noise signals of SIGNAL-1 is equal to 5+12+13=30.
SIGNAL-2: 810222334510
SIGNAL-2: 810222334510
Given N =10. A =2 and B =6.
Psychic waves cannot be detected in SIGNAL-2. The highest possible sequence is 5.
input data
The input has 2 lines.
Line 1: 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 5<= N <=100000 and 1< A - B <=.1000
Line 2 Integer - Number of steps with spaces. represents each numerical value that the instrument measures (The measured value will be in the range 1 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 1 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, 0 will be displayed on the screen.)
Example 1
input data
1025
810222334510
Export data
7
Example 2
input data
1357
241211917565121377
Export data
30
input data
1026
810222334510
Export data
5

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 Databases Questions!