포럼
문제 COCI00141

Dosadan

설명

Mirko received a message from his friend Slavko. Slavko, being a world class cryptologist, likes to encrypt messages he sends to Mirko. This time, he decided to use One Time Pad encryption. OTP is impenetrable if used correctly, and Slavko knows this. He however, doesn't want Mirko to bang his head on an impossible task, so he sent a few hints along with his message.

Mirko knows that Slavko's original plaintext contained only small letters of the English alphabet (az), full stop . and space (ASCII \(32\)). Also, he knows that Slavko used only digits 0 to 9 as his key. After much thought, he realized he can determine locations of all spaces and full stops in the plaintext. He now asked you to write a program that will do so automatically.

From his previous dealings with Slavko, Mirko knows how OTP encryption works. Let's look at a simple example. Suppose you want to encode the string abc efg using 0120123 as key. First, you transform both the key and plaintext into hexadecimal numbers using ASCII encoding. Then you align them and perform the XOR operation on each pair. The resulting sequence is the encrypted message.

$$ \begin{array}{lccccccc} \text{plaintext} & \texttt{a} & \texttt{b} & \texttt{c} & \texttt{ } & \texttt{e} & \texttt{f} & \texttt{g} \\ \text{key} & \texttt{0} & \texttt{1} & \texttt{2} & \texttt{0} & \texttt{1} & \texttt{2} & \texttt{3} \\ \text{plaintext (hex)} & 61 & 62 & 63 & 20 & 65 & 66 & 67 \\ \text{key (hex)} & 30 & 31 & 32 & 30 & 31 & 32 & 33 \\ \text{encrypted} & 51 & 53 & 51 & 10 & 54 & 54 & 54 \\ \end{array} $$

제약
입력 형식

The first line of input contains one integer \(N\) (\(1 \le N \le 1000\)), number of characters in the encrypted message.

The next line contains \(N\) integers, written in hexadecimal, larger than or equal to \(0\) and smaller than or equal to \(127\), the encrypted message.

출력 형식

The first and only line of output should contain \(N\) characters, each representing one character in the plaintext. If the \(i\)-th character of plaintext is a letter, the \(i\)-th character of output should be a dash -; if not, you should output a full stop ..

서브태스크
서브태스크점수설명

Test 1

10점

None

Test 2

10점

None

Test 3

10점

None

Test 4

10점

None

Test 5

10점

None

Test 6

10점

None

Test 7

10점

None

Test 8

10점

None

Test 9

10점

None

Test 10

10점

None

예제 1
입력
7
51 53 51 10 54 54 54
출력
---.---
예제 2
입력
7
53 53 51 54 54 51 10
출력
------.
문제 정보

riseoj 작성

출처 COCI 2009/2010 Contest 6

평가 및 의견

Dosadan

개요
출제자 난이도 Unrated 레이팅 미적용 의견 0 / 1 공개 집계 (커뮤니티 난이도, 주요 주제, 품질)는 의견이 충분히 모이면 공개됩니다.

Log in to rate problems.

개별 의견

아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.

풀이 제출

Dosadan

게스트로 둘러보고 있습니다. 로그인하면 풀이를 제출하고 진행 상황을 확인할 수 있습니다. 로그인하고 제출하기
공개
C++20 Tab 들여쓰기 · Ctrl+/ 주석 토글 · Enter 자동 들여쓰기
1 1 1 0 공백: 4 · UTF-8