• <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)

            隨筆分類

            隨筆檔案

            文章分類

            文章檔案

            友情鏈接

            搜索

            •  

            最新評論

            閱讀排行榜

            評論排行榜

            久久精品一区二区三区AV| 久久av免费天堂小草播放| 日韩精品久久久久久久电影| 久久无码高潮喷水| 99久久99这里只有免费费精品| 国产激情久久久久影院| 国内精品久久久久影院亚洲| 久久综合亚洲鲁鲁五月天| 久久精品一本到99热免费| 777米奇久久最新地址| 欧美大战日韩91综合一区婷婷久久青草| 欧美黑人激情性久久| 国产成人精品综合久久久| 国内精品久久久久久久久电影网| 一本久久久久久久| 久久久精品2019免费观看 | 国产精品国色综合久久| 国产免费久久精品99久久| 久久久久久九九99精品| 亚洲国产日韩综合久久精品| 国产—久久香蕉国产线看观看| 久久亚洲sm情趣捆绑调教| 久久久久亚洲AV无码专区桃色| 久久综合给合久久狠狠狠97色| 性做久久久久久久久老女人| 精品久久久久久无码人妻蜜桃| 狠狠色丁香久久综合五月| 久久久久无码精品国产不卡| 亚洲精品乱码久久久久久按摩| 综合久久久久久中文字幕亚洲国产国产综合一区首| AV无码久久久久不卡网站下载| 一本色道久久88—综合亚洲精品| 色妞色综合久久夜夜| 久久精品综合网| 久久午夜福利无码1000合集| 伊人久久大香线蕉无码麻豆| 亚洲欧美成人久久综合中文网 | 一本久久免费视频| 亚洲成av人片不卡无码久久| 久久精品三级视频| 欧美日韩精品久久久免费观看|