• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            posts - 195,  comments - 30,  trackbacks - 0

            Encoding schemes are often used in situations requiring encryption or information storage/transmission economy. Here, we develop a simple encoding scheme that encodes particular types of words with five or fewer (lower case) letters as integers.

            Consider the English alphabet {a,b,c,...,z}. Using this alphabet, a set of valid words are to be formed that are in a strict lexicographic order. In this set of valid words, the successive letters of a word are in a strictly ascending order; that is, later letters in a valid word are always after previous letters with respect to their positions in the alphabet list {a,b,c,...,z}. For example,

            abc aep gwz

            are all valid three-letter words, whereas

            aab are cat

            are not.

            For each valid word associate an integer which gives the position of the word in the alphabetized list of words. That is:

                a -> 1
            b -> 2
            .
            .
            z -> 26
            ab -> 27
            ac -> 28
            .
            .
            az -> 51
            bc -> 52
            .
            .
            vwxyz -> 83681

            Your program is to read a series of input lines. Each input line will have a single word on it, that will be from one to five letters long. For each word read, if the word is invalid give the number 0. If the word read is valid, give the word's position index in the above alphabetical list.

            Input

            The input consists of a series of single words, one per line. The words are at least one letter long and no more that five letters. Only the lower case alphabetic {a,b,...,z} characters will be used as input. The first letter of a word will appear as the first character on an input line.

            The input will be terminated by end-of-file.

            Output

            The output is a single integer, greater than or equal to zero (0) and less than or equal 83681. The first digit of an output value should be the first character on a line. There is one line of output for each input line.

            Sample Input

            z
            a
            cat
            vwxyz

            Sample Output

            26
            1
            0
            83681

             

            利用組合數學定理
            {1,2,3,--,n}的r組合a1,a2,--,ar出現在{1,2,--,n}的r組合的字典序中的位置號如下:

            C(n,r)-C(n-a1,r)-C(n-a2,r-1)-------C(n-ar-1,2)-C(n-ar,1):證明略;

            組合數C(n,r)計算利用pascal公式。C(n+1,k)=C(n,k-1)+C(n,k)
            posted on 2009-07-18 10:08 luis 閱讀(382) 評論(0)  編輯 收藏 引用 所屬分類: 組合數學
            <2009年7月>
            2829301234
            567891011
            12131415161718
            19202122232425
            2627282930311
            2345678

            常用鏈接

            留言簿(3)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            友情鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            精品无码久久久久国产| 久久精品人人做人人爽电影蜜月| 久久最近最新中文字幕大全| 久久精品亚洲精品国产色婷| 99久久精品无码一区二区毛片| 久久久久综合国产欧美一区二区| 日韩欧美亚洲综合久久| 久久青青草原亚洲av无码app| 777久久精品一区二区三区无码 | 精品免费tv久久久久久久| 久久国产亚洲精品麻豆| 亚洲一区精品伊人久久伊人| 97久久精品无码一区二区| 久久综合色之久久综合| 久久国产精品久久久| 狠狠色婷婷久久综合频道日韩| 亚洲乱亚洲乱淫久久| 精品久久久久久中文字幕大豆网| 久久狠狠色狠狠色综合| 久久久久亚洲AV成人片| 综合久久国产九一剧情麻豆| 久久久久久久亚洲精品| 久久精品国产69国产精品亚洲| 国产美女亚洲精品久久久综合 | 一级女性全黄久久生活片免费 | 久久99精品久久久久久动态图| 日韩AV毛片精品久久久| 9999国产精品欧美久久久久久| 东京热TOKYO综合久久精品| 欧美亚洲国产精品久久| 欧美久久久久久午夜精品| 国产巨作麻豆欧美亚洲综合久久 | 99久久免费国产精品特黄| 久久亚洲天堂| 久久艹国产| 久久www免费人成看国产片| 狠狠色丁香久久综合婷婷| 国产精品久久久久9999高清| 久久久噜噜噜久久中文福利| 久久亚洲日韩精品一区二区三区| 偷窥少妇久久久久久久久|