Ajuda em um problema em java

3 respostas
P

Tenho este problema para revolver alguém me pode ajudar sff!!? se quizerem o problema em português é só dizer , usarei o google trad. para isso xP !

Heat Peaks

The preparation of the World Cup 2018, to be held jointly by Spain and Portugal, is underway. It?s clear that the opening match will take place in one of the capitals, Madrid or Lisbon, and the final in the other. Both cities prefer the final, of course, and are gathering arguments in favor of their own bid. For example, the Portuguese are now claiming that Madrid is too hot in summer, and an important match, such as the final, might lose some of its glamour if it has to be played in unbearable weather conditions.

In order to substantiate this claim, more precisely the claim that the weather in Lisbon is much nicer than the weather in Madrid, the Portuguese are studying the temperature records of both capitals, counting the heat peaks. Their thesis is that heat peaks occur in Madrid much more often than in Lisbon. If this is true, indeed it might be wise to hold the final in Lisbon, since the probability of having if fall in a very hot day is smaller.

For this purpose, the Portuguese invented an ad-hoc definition of heat peak: a heat peak is a sequence of 7 or more consecutive days where the maximum temperature is greater than or equal to 30 degrees, and such that within those 7 days, at least in 4 consecutive days the temperature is greater than or equal to 34 degrees, and, additionally, such that within those 4 days with temperature greater than or equal to 34, at least in 2 consecutive days the temperature is greater than or equal to 36 degrees.
Task

Your task is to create a program that will go through the temperature records of a certain location and discover the heat peaks that have occurred, and their intensity. Your program should use a more general definition of heat peak: a maximal sequence of N1 or more consecutive days where the maximum temperature is greater than or equal to T1 degrees, and such that within those N1 days, at least in N2 consecutive days the temperature is greater than or equal to T2 degrees, and, additionally, such that within one of those N2 days with temperature greater than or equal to T2, at least in N3 consecutive days the temperature is greater than or equal to T3 degrees. The word ?maximal? is used in a technical sense: it means that we want sequences that cannot be extended either backward or forward. In other words, a ?sequence of N1 or more consecutive days (?)? within a larger such sequence is not to be considered a heat peak.

The intensity of the heat peak is the sum of the daily maximum temperatures during the entire heat peak.
Input

The first line of the input contains six integers, separated by spaces, representing the values of the constants N1, N2, N3, T1, T2 and T3, in this order.

An undetermined number of lines follow, with an integer in each line. This sequence of numbers represents the maximum temperatures recorded, day by day, up to today.
Output

The output shall display the number of heat peaks in the first line, followed by a line for each heat peak, in chronological order. Each of these lines shall have three numbers, separated by a space: the date the heat peak started, its length and its intensity. The date shall be represented by the number of days that have passed since the heat peak started. In other words, the value D for a date means D day ago. For instance: 0 means today, 1 means yesterday. In case there are more than 16 heat peaks, only the 16 most recent ones shall be displayed (but remember that the first line must display the total number of peaks found); otherwise, all are displayed. In case no heat peaks have been found, the output shall contain a single line, with the message ?no heat peaks? (without the quotes).
Constraints

The number of lines in the input is not greater than 100001.

Temperature limits: T1 ≤ T2 ≤ T3.

Lengths of sequences of days: N1 ≥ N2 ≥ N3 ≥ 1.
Input example 1

7 4 2 30 34 36

28

29

31

31

31

34

35

27

37

35

39

38

35

39

38

37

37

32

35

28

28

38

39

32

32

28

28

29

29

24

Output example 1

1

21 11 402

Input example 2

4 3 2 10 15 20

11

12

15

20

15

12

11

Output example 2

no heat peaks

3 Respostas

ViniGodoy

O que vc já fez?

andwolf

Sem sua duvida mais especifica fica difícil, qual é seu verdadeiro problema com este problema?

caio_ferreira

rsrs, boa

qual é seu verdadeiro problema com este problema?

o pessoal não vai nem ler isso ai

Criado 30 de setembro de 2010
Ultima resposta 30 de set. de 2010
Respostas 3
Participantes 4