• <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>
            心如止水
            Je n'ai pas le temps
            posts - 400,comments - 130,trackbacks - 0
            題目很簡單:給出一系列要忽略的單詞,這些單詞以外的單詞都看作關鍵字。然后給出一些標題,找出標題中所有的關鍵字,然后按這些關鍵字的字典序給標題排序。注意兩點:相同關鍵字出現在不同標題中,出現在輸入較前位置的標題排在前面(從樣例數據可以看出,而且multimap也正是這么做的);同一個關鍵字在一個標題中出現多次,關鍵字位于較前位置的排在前面(從左向右掃描的話就沒有問題)。
            STL中<set>、<map>神器!用起來很方便,只是擔心我再這么用下去Qsort、Bsearch什么的自己都不會寫了~
            以下是我的代碼:
            #include<iostream>
            #include
            <string>
            #include
            <map>
            #include
            <set>
            #include
            <cstdio>
            #include
            <cctype>
            using namespace std;
            const int kMaxn(207);
            const string kSign("::");

            int main()
            {
                
            /*
                freopen("data.in","r",stdin);
                freopen("data.out","w",stdout);
                //
            */

                
            set<string> ignore;
                
            string t;
                
            while(getline(cin,t) && t!=kSign)
                    ignore.insert(t);
                multimap
            <string,string> r;
                
            while(getline(cin,t))
                {
                    
            for(int i=0;i<t.size();i++)
                        t[i]
            =tolower(t[i]);
                    
            for(int i=0;i<t.size();i++)
                    {
                        
            if(!isalpha(t[i]))
                            
            continue;
                        
            int j(i);
                        
            string t2;
                        
            while(j<t.size() && isalpha(t[j]))
                        {
                            t2
            +=t[j];
                            j
            ++;
                        }
                        
            if(!ignore.count(t2))
                        {
                            
            for(int k=0;k<t2.size();k++)
                                t2[k]
            =toupper(t2[k]);
                            
            string t3(t);
                            t3.replace(i,t2.size(),t2);
                            r.insert(make_pair(t2,t3));
                        }
                        i
            =j;
                    }
                }

                
            for(map<string,string>::iterator i=r.begin();i!=r.end();i++)
                    cout
            <<i->second<<endl;

                
            return 0;
            }
            posted on 2011-04-11 01:50 lee1r 閱讀(987) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:字符串處理題目分類:排序
            精品久久一区二区| 久久精品蜜芽亚洲国产AV| 久久超碰97人人做人人爱| 久久夜色精品国产噜噜亚洲a | 亚洲中文久久精品无码| 青青草原综合久久大伊人导航| 26uuu久久五月天| 久久国产香蕉一区精品| 久久久青草青青国产亚洲免观| 99久久国产综合精品成人影院| 久久免费小视频| 国产99久久九九精品无码| 国产免费久久精品99久久| 久久国产成人亚洲精品影院| 国产精品激情综合久久| 久久精品成人免费观看97| 一本久久综合亚洲鲁鲁五月天| 中文成人无码精品久久久不卡| 久久久久久精品久久久久| 久久久久人妻一区精品色| 99久久精品费精品国产一区二区| 久久福利青草精品资源站| 精品99久久aaa一级毛片| 久久久久无码中| 人妻无码久久一区二区三区免费| 99国产欧美久久久精品蜜芽| 91精品久久久久久无码| 国产99久久久国产精品小说| 久久精品国产亚洲77777| 国产激情久久久久影院小草| 久久精品国产99国产精品导航 | 亚洲国产一成久久精品国产成人综合| 久久精品免费全国观看国产| 97久久精品国产精品青草| 日批日出水久久亚洲精品tv| 久久精品亚洲日本波多野结衣 | 久久精品草草草| 18禁黄久久久AAA片| 日本精品久久久中文字幕| 中文字幕日本人妻久久久免费| 久久青草国产精品一区|