Logo
(追記) (追記ここまで)

21170번 - Digital Speedometer 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 (추가 시간 없음) 1024 MB78232039.216%

문제

A digital speedometer shows a vehicle's speed as integer miles per hour. There are occasions when the sensed speed varies between two integer values, such as during cruise control. Using a single threshold to round between adjacent integers often makes the display toggle rapidly between the two integers, which is distracting to the driver.

Your team must implement a smoothing technique for the display using separate rising and falling thresholds ($t_r$ and $t_f,ドル $t_f < t_r,ドル respectively). See Figure 1 for a graphical depiction of the Sample Input for use with the following rules.

Figure 1: Sensor reading from the Sample Input, with $t_f=0.25$ and $t_r=0.75$.

Each sensed speed, $s,ドル falls between two adjacent integers $i$ and $j,ドル $i \le s < j,ドル where $j = i + 1$. When displaying the sensed speed $s$ as an integer:

  • When $s$ falls between $i$ and $i+t_f,ドル $s$ is displayed as $i$.
  • When $s$ falls between $i+t_r$ and $j,ドル $s$ is displayed as $j$.
  • When $s$ falls between $i+t_f$ and $i+t_r,ドル $s$ is displayed as $i$ if the most recent preceding value for $s$ outside of range $[i+t_f, i+t_r]$ is less than $i+t_r,ドル and $s$ is displayed as $j$ if the most recent preceding value for $s$ outside of range $[i+t_f, i+t_r]$ is greater than $i+t_r$.
  • Any sensed speed, 0ドル < s < 1,ドル must display as 1ドル$ because any non-zero speed, no matter how small, must display as non-zero to indicate that the vehicle is in motion.

입력

The first line of input contains $t_f,ドル the falling threshold. The second line of input contains $t_r,ドル the rising threshold. The speed sensor reports $s$ in increments of 0ドル.1$ mph. The thresholds are always set halfway between speed increments. All remaining lines until end-of-file are successive decimal speeds, $s,ドル in miles per hour, one speed per line. The third line of input, which is the first measured speed, will always be 0ドル$. There are at most 1000ドル$ observed speeds $s$ in input. $0ドル < t_f,t_r < 1; \ \ \ \ t_f < t_r; \ \ \ \ 0 \le s \le 120$$

출력

Output is the list of speeds, one speed per line, smoothed to integer values appropriate to $t_f$ and $t_r$.

제한

예제 입력 1

0.25
0.75
0
2.0
5.7
5.8
5.7
5.2
5.7
0.8
0.2

예제 출력 1

0
2
5
6
6
5
5
1
1

힌트

Input Output Explanation
0.25 Value of $t_f$.
0.75 Value of $t_r$.
0 0 Initial input.
2.0 2 Input greater than 0ドル,ドル below threshold of 2ドル.25$.
5.7 5 Input greater than 2ドル.0,ドル in threshold range.
5.8 6 Input greater than 2ドル.0,ドル exceeds upper threshold of 5ドル.75$.
5.7 6 Input less than 5ドル.8,ドル in threshold range.
5.2 5 Input less than 5ドル.8,ドル below threshold of 5ドル.25$.
5.7 5 Input greater than 5ドル.2,ドル in threshold range.
0.8 1 Input greater than 0ドル$ and less than 1ドル$.
0.2 1 Input greater than 0ドル$ and less than 1ドル$.

출처

ICPC > Regionals > North America > North Central North America Regional > NCNA 2020 H번

ICPC > Regionals > North America > Southern California Regional > 2020 Southern California Regional 5번

  • 문제를 만든 사람: Ed Skochinski
(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /