PKU 1496 1850

这两个题实际上是一样的 后面一个数据范围要大些

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


要求给出一个字符串让你求出它的序号

以一个5位字符串为例
1 先求出1-4位所有字符串的个数 就是C(26,i);
2 再从该5位字符串第二位开始到最后一位 每位所取数字都在S[I-1]+1到S[I]-1之间,而后对后面几位用组合数求个数 累计相加就是

posted on 2008-02-18 14:48 Victordu 阅读(612) 评论(0)  编辑 收藏 引用


只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


导航

<2008年2月>
272829303112
3456789
10111213141516
17181920212223
2425262728291
2345678

统计

常用链接

留言簿(5)

随笔档案(46)

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜