• <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>
            輸入一個字典(用******結尾),然后再輸入若干單詞。每輸入一個單詞w,你都需要在字典中找出所有可以用w的字母重排后得到的單詞,并按照字典序從小到大的順序在一行中輸出(如果不存在,輸出:(  )輸入單詞之間用空格或空行隔開。注意,字典中的單詞不一定按字典排列。

            樣例輸入:
            tarp given score refund only trap work earn course pepper part
            ******
            resco nfudre aptr sett oresuc
            樣例輸出:
            score
            refund
            part tarp trap
            :(
            course
            代碼:
            #include <iostream>
            #include 
            <algorithm>
            #include 
            <string>
            #include 
            <string.h>

            const int maxn = 1000+10;

            using std :: string;
            using std :: sort;
            using std :: cin;
            using std :: cout;
            using std :: endl;

            int main()
            {

                
            string word[maxn];                      //用string類,方便對字符串排序
                char sorted[maxn][maxn],buf[maxn];
                
            int i = 0;

                
            for( ; ; i++)
                {
                    cin 
            >> word[i];
                    
            if(word[i][0]=='*')     break;       //把字典存入word[]中
                }

                sort(word,word
            +i);                        //先把字典排序

                
            for(int t=0; t<i; t++)
                {
                    strcpy(sorted[t],word[t].c_str());   
            //把字典中的數據存入另一個數組里
                    sort(sorted[t],sorted[t]+strlen(sorted[t]));    //把存儲完的字典中每一個單詞的字母排序
                }

                
            while(~scanf("%s", buf))
                {
                    
            bool found = 0 ;
                    sort(buf,buf
            +strlen(buf));                  //把讀入的字符串按字母排序

                    
            for(int t=0; t < i ; t++)
                    {              
            //從排序后的字典中查找
                        if(!strcmp(buf,sorted[t]))           //如果找到
                        {
                            found 
            = 1;
                            cout 
            << word[t] << " " ;        //輸出原字典中對應的單詞
                        }
                    }
                    
            if(!found)   cout << ":(--->>>Not found";    //如果沒有找到則輸出Not found
                    cout << endl;
                }
                
            return 0;
            }
            posted on 2010-05-26 18:32 Vontroy 閱讀(1425) 評論(0)  編輯 收藏 引用 所屬分類: ACM Experience
            久久91亚洲人成电影网站| 国产精品免费福利久久| 婷婷久久精品国产| 狠狠色狠狠色综合久久| 色综合久久无码中文字幕| 伊人久久综在合线亚洲2019| 亚洲午夜久久久| 久久精品www| 久久精品国产乱子伦| 91精品国产综合久久婷婷| 久久久久亚洲AV无码去区首| 久久久久久亚洲AV无码专区| 久久久久一级精品亚洲国产成人综合AV区| A级毛片无码久久精品免费| 青青青青久久精品国产| 色综合久久中文字幕无码| 久久精品无码av| 国产精品99久久精品| 久久亚洲精品无码VA大香大香| 精品久久香蕉国产线看观看亚洲| 免费精品久久天干天干| 久久国产精品波多野结衣AV| 97r久久精品国产99国产精| 久久久SS麻豆欧美国产日韩| 欧美大战日韩91综合一区婷婷久久青草| 久久精品aⅴ无码中文字字幕不卡 久久精品aⅴ无码中文字字幕重口 | 久久国产精品-国产精品| 久久天天躁夜夜躁狠狠| 日韩va亚洲va欧美va久久| 久久国产乱子伦精品免费强| 久久久久高潮毛片免费全部播放| 区亚洲欧美一级久久精品亚洲精品成人网久久久久 | 久久精品亚洲日本波多野结衣| 伊人色综合久久天天网| 久久夜色撩人精品国产小说| 久久精品国产一区二区| 久久综合九色综合精品| 久久久久综合网久久| 亚洲国产精品人久久| 国产精品久久久久一区二区三区| 青青草国产成人久久91网|