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之間,而后對后面幾位用組合數求個數 累計相加就是