[BOJ 13860] Letters

View as PDF

Submit solution

Points: 2
Time limit: 0.2s
Memory limit: 256M

Problem types
Allowed languages
Assembly, Awk, C, C++, Java, Pascal, Perl, Python, Sed, Text

We build the infinite sequence of uppercase letters (A-Z) which starts with single-letter strings (A, B, …, Z), continues with two-letter strings (AA, AB, …, AZ, BA, BB, …, BZ, …, ZZ), then threeletter strings and so on. The same-length strings are ordered lexicographically. We are interested in finding which letter sits at a given index in the sequence.

입력 형식

The letter index, ranging between 0 and 2*109 .

출력 형식

The letter at the specified index.

예제 입력 1

0

예제 출력 1

A

예제 입력 2

25

예제 출력 2

Z

예제 입력 3

50

예제 출력 3

A

예제 입력 4

100

예제 출력 4

B

예제 입력 5

250

예제 출력 5

E

예제 입력 6

500

예제 출력 6

J

예제 입력 7

1000

예제 출력 7

S

Comments

There are no comments at the moment.