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

13093번 - North North West 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
8 초 (추가 시간 없음) 512 MB54313068.182%

문제

We can describe detailed direction by repeating the directional names: north, south, east and west. For example, northwest is the direction halfway between north and west, and northnorthwest is between north and northwest.

In this problem, we describe more detailed direction between north and west as follows.

  • "north" means 0 degrees.
  • "west" means 90 degrees.
  • If the direction dir means a degrees and the sum of the occurrences of "north" and "west" in dir is n (≥ 1), "north"dir (the concatenation of "north" and dir) means a−(90/2n) degrees and "west"dir means a+(90/2n) degrees.

Your task is to calculate the angle in degrees described by the given direction.

입력

The input contains several datasets. The number of datasets does not exceed 100.

Each dataset is described by a single line that contains a string denoting a direction. You may assume the given string can be obtained by concatenating some "north" and "west", the sum of the occurrences of "north" and "west" in the given string is between 1 and 20, inclusive, and the angle denoted by the given direction is between 0 and 90, inclusive. The final dataset is followed by a single line containing only a single "#".

출력

For each dataset, print an integer if the angle described by the given direction can be represented as an integer, otherwise print it as an irreducible fraction. Follow the format of the sample output.

제한

예제 입력 1

north
west
northwest
northnorthwest
westwestwestnorth
#

예제 출력 1

0
90
45
45/2
315/4

힌트

출처

Contest > ICPC Japanese Alumni Group > JAG Practice Contest for ICPC Asia Regional > JAG Practice Contest for ACM-ICPC Asia Regional 2014 A번

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

출처

대학교 대회

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

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