题目名称 2684. [POJ 1850] 编码
输入输出 poj1850.in/out
难度等级 ★★
时间限制 1000 ms (1 s)
内存限制 5 MiB
测试数据 10
题目来源 GravatarAAAAAAAAAA 于2017-04-28加入
开放分组 全部用户
提交状态
分类标签
分享题解
通过:11, 提交:21, 通过率:52.38%
GravatarAAAAAAAAAA 100 0.000 s 0.00 MiB C++
Gravatar1020 100 0.001 s 0.31 MiB C++
Gravatar泪寒之雪 100 0.002 s 0.32 MiB C++
Gravatarthmyl 100 0.002 s 0.32 MiB C++
Gravatar1020 100 0.003 s 0.32 MiB C++
Gravatarkonnyaku 100 0.003 s 0.32 MiB C++
Gravatarbear 100 0.004 s 0.32 MiB C++
GravatarShirry 100 0.004 s 0.32 MiB C++
Gravatar不存在的 100 0.004 s 0.32 MiB C++
Gravatarkonnyaku 100 0.004 s 0.32 MiB C++
关于 编码 的近10条评论(全部评论)
没看见 若不在字典中输出0
所以混分警告
#include <cstdio>
int main() {
cout<<0;
return 0;
}

就是20分
Gravatarkonnyaku
2017-10-11 21:47 2楼
真是醉了...
Gravatar不存在的
2017-04-28 22:57 1楼

2684. [POJ 1850] 编码

★★   输入文件:poj1850.in   输出文件:poj1850.out   简单对比
时间限制:1 s   内存限制:5 MiB

【题目描述】


Transmitting and memorizing information is a task that requires different coding systems for the best use of the available space. A well known system is that one where a number is associated to a character sequence. It is considered that the words are made only of small characters of the English alphabet a,b,c, ..., z (26 characters). From all these words we consider only those whose letters are in lexigraphical order (each character is smaller than the next character).


The coding system works like this:

• The words are arranged in the increasing order of their length.

• The words with the same length are arranged in lexicographical order (the order from the dictionary).

• We codify these words by their numbering, starting with a, as follows:

a - 1

b - 2

...

z - 26

ab - 27

...

az - 51

bc - 52

...

vwxyz - 83681

...


Specify for a given word if it can be codified according to this coding system. For the affirmative case specify its code.

题目大意:求出给定的字符在字典中的编码,字典中的单词由小写字母组成且,s满足对于任意字符s[i]<s[i+1]。

字典从"a"开始。


【输入格式】

要处理的字母

【输出格式】

编号,若不在字典中输出0

【样例输入】

bf

【样例输出】

55

【来源】

POJ1850