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

34368번 - Compass Rose 스페셜 저지다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB1099100.000%

문제

Your friend Rose works as an intern at the United States Geologic Survey (USGS) on Mines campus. She has taken you up to a geological site in Boulder and given you some locations at which you are to take geological measurements. Her instructions to get to these locations include headings that you're having trouble decoding. These headings are strings consisting of between one and ten cardinal directions (N, S, E, and W) and correspond to an angle that you can set your compass to, to travel in the right direction. For example, the heading WSW corresponds to the angle 247ドル.5^{\circ}$. Rose's instructions include a lot of these headings, but you don't have their corresponding angles memorized, so you decide to write a quick script to do the conversions for you.

Headings are defined as follows.

  • \item Single character headings (N, S, E, and W) correspond to 0ドル^{\circ},ドル 180ドル^{\circ},ドル 90ドル^{\circ},ドル and 270ドル^{\circ},ドル respectively.

  • \item Two character headings (NE, NW, SE, SW) correspond to 45ドル^{\circ},ドル 315ドル^{\circ},ドル 135ドル^{\circ},ドル and 225ドル^{\circ},ドル respectively.

  • \item Headings of length $n \geq 3$ are composed of a valid heading of length $n - 1,ドル with one of the characters in that heading prepended to it, to add additional specificity to the heading.

    For example, we take the heading NE (45ドル^{\circ}$) but would like to add more specificity. We can prepend either N to form NNE (22ドル.5^{\circ},ドル halfway between 0ドル^{\circ}$ and 45ドル^{\circ}$) or E to form ENE (67ドル.5^{\circ},ドル halfway between 90ドル^{\circ}$ and 45ドル^{\circ}$).

    Similarly, we can form NNNE (12ドル.25^{\circ},ドル halfway between 0ドル^{\circ}$ and 22ドル.5^{\circ}$) and ENNE (33ドル.75^{\circ},ドル halfway between 22ドル.5^{\circ}$ and 45ドル^{\circ}$) from NNE by prepending N or E, respectively. However, we cannot prepend S or W (forming SNNE or WNNE) because NNE only contains the cardinal directions N and E, and so we can only prepend those characters to it.

입력

The first line of input contains 1ドル \leq n \leq 1,000円,ドル the number of test cases to follow. Each of the following $n$ lines contains a heading $D$ such that 1ドル \leq |D| \leq 10,ドル that is, each heading will be at most 10ドル$ characters. You may assume that all headings given follow the definition provided above, and there will not be any invalid headings.

출력

You should output $n$ lines, with the $i^{\text{th}}$ line containing a real number, the compass heading (in degrees) corresponding to the given heading $D_i$.

Answers within 10ドル^{-8}$ of the correct answer will be accepted. If a compass heading does not contain a decimal portion, it can be omitted.

제한

예제 입력 1

2
W
N

예제 출력 1

270
0

예제 입력 2

6
NW
ESE
ENNE
SESE
WNNNW
WWWSW

예제 출력 2

315.0
112.5
33.75
123.75
343.125
264.375

힌트

출처

School > CS@Mines > CS@Mines HSPC 2023 > Beginner G번

School > CS@Mines > CS@Mines HSPC 2023 > Advanced F번

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

출처

대학교 대회

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

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