루미 알고리즘

#1387골드Mars Message

PO 2016 결선코딩출제 Johan Sannemo영어 원문이 문제가 어렵다면 — 배우는 순서 보기

영어 원문입니다. 원문의 수식·표를 글자로 옮겨 모양이 다를 수 있습니다. 정확한 내용은 원문 페이지에서 확인하세요. 원문 페이지 열기 (새 창)

Problem

In the film The Martian, astronaut Mark Watney is stuck on Mars, and communicates with earth by rotating a camera on an old space prod.

The prod points at a hexidecimal digit, i.e. 0-9 or a-f, and Mark creates letters and other characters by converting a pair of hexadecimal digits according to ASCII encoding. To determine which digit the prod is pointing at Mark has divided a circle of 360 degrees into 16 parts of 22.5 degrees each.

(그림은 원문 저장소에서 볼 수 있습니다)

For example, the pair of angles (100*∘, 30°) represents the hexadecimal number 41, which in decimal is 65. According to ASCII (https://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters) that is the character A.

Mark is getting tired of writing down the digits manually, and he asks you to help him decode the messages he receives. You will be given the sequence of angles the prod points at and you're expected to print the message.

Input

The first line consists of an integer 2 ≤ N ≤ 50000, the number of angles. N will be even.

The following N lines contain angles, one angle per line. An angle is given in degrees as a float in the range [0, 360). The prod will never point at an angle which is exactly inbetween two hexadecial digits.

When decoding to ASCII only characters with decimal values 32-126 occurs.

Output

Print one line with the decoded message.

Grading

Your solution will be tested on several groups of test cases. To get points for a group you need to pass all the tests of that group.

GroupPointsConstraints
146all angles are integers
254

예제

예제 1

입력
54
91
118
157
23
167
66
158
100
157
189
47
21
172
98
139
353
59
10
139
314
146
23
160
48
162
70
63
316
55
21
94
95
144
353
53
11
166
203
147
339
158
115
46
3
157
83
149
339
160
18
177
218
69
339
출력
Earth to mars. Do you copy?

출처 표기

출처: Programmeringsolympiaden 2016년 결선 · 원문 페이지 · 이용 조건 CC BY-SA · LaTeX 원문을 화면용 글로 옮겼습니다(수식·표의 모양이 다를 수 있습니다). 내용은 고치지 않았습니다.

크리에이티브 커먼즈 저작자표시-동일조건변경허락.

문제 출처: 한국정보올림피아드(KOI) (CC BY-NC-SA 4.0) · International Olympiad in Informatics (IOI) (CC BY) · Centre for Education in Mathematics and Computing (CEMC), University of Waterloo (CC BY-NC 4.0) · Programmeringsolympiaden (CC BY-SA) · CSES Problem Set (Antti Laaksonen) (CC BY-NC-SA 4.0). 루미 알고리즘은 위 단체들과 관계없는 별도의 서비스이며, 자료는 원문 그대로 싣습니다. 문제마다 출처와 이용 조건을 따로 표기합니다.