RiseOJ는 solved.ac와 제휴 관계가 없습니다. 티어 아이콘 © solved.ac. solved.ac
포럼
R03660

Twofive

Unrated 레이팅 미적용
난이도
2s
시간 제한
256MB
메모리 제한
0
맞았습니다!!
0
제출 수
0.0%
정답률
레이팅

의견: 0

설명

D
Tampere
Finland

twofive
twofive

Twofive

PROBLEM

The secret messages between Santa Claus and his little helpers are usually encoded in
the 25-language. The 25-alphabet is the same as the Latin alphabet with one exception
- the letter 'Z' is absent, i.e. the 25-alphabet contains 25 Latin letters from 'A' through
'Y' in the same order as the Latin alphabet. Each word in the 25-language consists of
exactly 25 different letters. A word can be written in a 5x5 table filling the rows first;
for example, the word ADJPTBEKQUCGLRVFINSWHMOXY will be written as
follows:
A
D
J
P
T
B
E
K
Q
U
C
G
L
R
V
F
I
N
S
W
H
M
O
X
Y

A valid word in the 25-language has its letters in each row as well as in each column
written in ascending order. Thus, the word ADJPTBEKQUCGLRVFINSWHMOXY
is a valid word, in contrast to the word ADJPTBEGQUCKLRVFINSWHMOXY (the
ascending order is violated in the second column, and in the third column, too).

Santa Claus has a lexicon. His lexicon is the list of all valid 25-language words in
ascending order (lexicographically) along with their ordinal numbers starting from 1.
For example, in the lexicon ABCDEFGHIJKLMNOPQRSTUVWXY is the word
number 1 and ABCDEFGHIJKLMNOPQRSUTVWXY is the word number 2. In
word number 2, U and T are interchanged from their order in word number 1.

Unfortunately, this lexicon is huge. Write a program that determines the ordinal
number of an arbitrary given word, and also the word corresponding to a given ordinal
number. There are no more than 231 words in the lexicon.

Note (RiseOJ) — The original statement describes file-based input/output; on this judge your program must read from standard input and write to standard output instead.

제약
입력 형식

The input file is named twofive.in and consists of two lines. The first line
contains a string with one character: a 'W' or an 'N'. If the first line contains a 'W', then
the second line contains a valid 25-language word, that is, a string with 25 characters.
If the first line contains an 'N', then the second line contains the ordinal number of an
existing 25-language word.

출력 형식

The output file is named twofive.out and consists of one line. If the second line
of the input file contains a 25-language word, then the line of the output file contains
the ordinal number of that word. If the second line of the input file contains a number,
then the line of the output file contains the 25-language word with that ordinal
number.

D
Tampere
Finland

twofive
twofive

EXAMPLE INPUTS AND OUTPUTS

twofive.in

twofive.out

twofive.in

twofive.out

W
ABCDEFGHIJKLMNOPQRSUTVWXY
2
N
2
ABCDEFGHIJKLMNOPQRSUTVWXY

문제 정보

생성자가 기록되지 않았습니다.

출처 IOI 2001

평가 및 의견

Twofive

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

Log in to rate problems.

개별 의견

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

풀이 제출

Twofive

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