• <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
            先對讀入的字符串做如下處理:1、全部的'5'變成' ';2、刪除前導的0(數字0本身需要保留)。
            然后使用istringstream即可讀入數字,之后對其進行排序并輸出。
            以下是我的代碼:
            #include<iostream>
            #include
            <sstream>
            #include
            <string>
            #include
            <algorithm>
            #include
            <cstdio>
            using namespace std;

            int main()
            {
                
            /*
                freopen("data.in","r",stdin);
                freopen("data.out","w",stdout);
                //
            */
                
                
            string num;
                
            while(cin>>num)
                {
                    num.insert(num.begin(),
            '5');
                    
            for(int i=0;i<num.size();i++)
                        
            if(num[i]=='5')
                        {
                            num[i]
            =' ';
                            
            int j=i+1;
                            
            while(j<num.size() && num[j]=='0')
                            {
                                
            if(j+1<num.size() && num[j+1]!='5')
                                    num[j]
            =' ';
                                j
            ++;
                            }
                        }
                    
            /*
                    cout<<"After dealing : "<<num<<endl;
                    //
            */
                    
                    istringstream sin(num);
                    
            int n(0),r[1001],t;
                    
            while(sin>>t)
                        r[n
            ++]=t;
                    sort(r,r
            +n);
                    
                    
            for(int i=0;i<n;i++)
                    {
                        
            if(i!=0) cout<<" ";
                        cout
            <<r[i];
                    }
                    cout
            <<endl;
                }
                
            return 0;
            }
            posted on 2011-02-28 22:04 lee1r 閱讀(438) 評論(0)  編輯 收藏 引用 所屬分類: 題目分類:字符串處理
            日韩一区二区久久久久久| 久久久久99精品成人片牛牛影视| 亚洲七七久久精品中文国产| 久久久久无码国产精品不卡| 欧美久久久久久午夜精品| 久久久久久久久久久精品尤物| 久久久无码一区二区三区| 9191精品国产免费久久| 久久天天躁狠狠躁夜夜2020一 | 国产成人精品久久综合| 怡红院日本一道日本久久| 精品国产日韩久久亚洲| 国内精品久久久久影院免费| 国内精品久久国产| 国产精品综合久久第一页| 久久综合香蕉国产蜜臀AV| 精品久久久久久无码人妻蜜桃| 亚洲AV日韩精品久久久久| 欧美麻豆久久久久久中文| 久久免费国产精品一区二区| 久久99久久99精品免视看动漫 | 久久久久久精品免费看SSS | 久久91这里精品国产2020| 久久精品无码专区免费青青| 国产精品久久久久久久久软件 | 无码国内精品久久人妻蜜桃| 亚洲欧美日韩久久精品| 99热成人精品免费久久| 久久国产精品国产自线拍免费| 久久久久久久女国产乱让韩| 亚洲精品国产综合久久一线| 久久九色综合九色99伊人| 九九久久精品国产| 看全色黄大色大片免费久久久| 97久久精品人人做人人爽| 久久婷婷综合中文字幕| 欧美综合天天夜夜久久| 999久久久免费国产精品播放| 久久精品国产99久久丝袜| 久久午夜无码鲁丝片秋霞| 久久黄视频|