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

25997번 - Failing Flagship 스페셜 저지다국어

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

문제

Ahoy! You are sailing towards the next "Boats Are Pretty Cool" convention to sell your latest gadget: a new type of compass.

On a normal compass, it is difficult to read off the precise wind direction. However, your new type of compass lets you read off wind directions to a much higher precision! The display can display strings of at most 1000ドル$ characters.

Unfortunately, you have encountered some bad weather. After a few hours of heavy winds and big waves, you can finally look at your compass again. You read off the wind direction $X$ you are going and know in which wind direction $Y$ you need to go. However, to make the ship turn you have to enter the degrees of the angle the ship has to make in the control system. What is the smallest turn, in degrees, you have to make to get back on the right course?

Figure F.1: Wind directions

The conversion of a wind direction to degrees goes as follows. The four basic wind directions are N, E, S, and W pointing at 0ドル,ドル 90ドル,ドル 180ドル,ドル and 270ドル$ degrees, respectively. There are also four wind directions consisting of two letters: NE, SE, SW, and NW, pointing at 45ドル,ドル 135ドル,ドル 225ドル,ドル and 315ドル$ degrees, respectively.

A wind direction can also consist of $k\geq 3$ letters $l_1l_2\ldots l_k$. In that case, the last two letters indicate one of the four two-letter wind directions, i.e., $l_{k-1}l_k \in \{\text{NE}, \text{SE}, \text{SW}, \text{NW}\}$ and the other letters are equal to one of these, i.e., $l_i \in \{l_{k-1}, l_k\}$ for all $i \leq k-2$. This wind direction points precisely in the middle of the following two wind directions:

  • wind direction $l_2\ldots l_k,ドル
  • the first wind direction of at most $k-1$ letters you encounter when starting in $l_2\ldots l_k$ and move along the circle towards $l_1$.

For example, the wind direction SSSE points in the middle of SSE and S, because S is the first wind direction with at most 3 letters when moving from SSE towards S, as can also been seen in Figure F.1.

입력

The input consists of:

  • One line with two strings $X$ and $Y$ (1ドル \leq |X|, |Y| \leq 1000$), indicating the wind directions as described above.

출력

Output the smallest turn you have to make to go from direction $X$ to $Y$.

Your answer should have an absolute error of at most 10ドル^{-6}$.

제한

예제 입력 1

N S

예제 출력 1

180

예제 입력 2

NNE SSSE

예제 출력 2

146.25

예제 입력 3

ENE NW

예제 출력 3

112.5

힌트

출처

ICPC > Regionals > Europe > Northwestern European Regional Contest > Benelux Algorithm Programming Contest > BAPC 2022 F번

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

출처

대학교 대회

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

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