• <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 閱讀(1430) 評論(0)  編輯 收藏 引用 所屬分類: ACM Experience
            99久久国产综合精品女同图片| 久久婷婷成人综合色综合| 97久久精品无码一区二区天美| 国产精品久久午夜夜伦鲁鲁| 热99re久久国超精品首页| 久久这里只有精品视频99| 热re99久久精品国99热| 国产农村妇女毛片精品久久| 超级碰碰碰碰97久久久久| 免费观看久久精彩视频| 亚洲国产精品狼友中文久久久| 久久精品无码专区免费东京热| 国产福利电影一区二区三区,免费久久久久久久精 | 久久久久久久女国产乱让韩| 国产精品99久久免费观看| 亚洲精品高清一二区久久| 2022年国产精品久久久久| 久久丫忘忧草产品| 久久精品成人影院| 一本一道久久精品综合| 久久婷婷成人综合色综合| 久久久黄色大片| 久久国产精品无码网站| 国产精品久久久久久久| 色综合久久无码中文字幕| 久久中文字幕精品| 久久噜噜久久久精品66| 人人狠狠综合久久亚洲88| 久久99精品久久久久子伦| 久久SE精品一区二区| 热久久视久久精品18| 人妻少妇精品久久| 亚洲七七久久精品中文国产| 国产精品九九久久免费视频 | 久久乐国产精品亚洲综合| 久久美女人爽女人爽| 久久精品国产91久久麻豆自制| 久久精品国产亚洲AV麻豆网站| 久久精品蜜芽亚洲国产AV| 久久99精品国产99久久6男男| 国内精品人妻无码久久久影院|