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

            了解了使用string時(shí)常犯的錯(cuò)誤:c_str函數(shù)的返回值是const char*的,因此絕對(duì)不能scanf("%s",s.c_str());。
            另外題目中建議使用scanf()(本來(lái)使用cin/cout一點(diǎn)事情都沒(méi)有,結(jié)果換了scanf()/printf()發(fā)現(xiàn)了這個(gè)錯(cuò)誤)。

            #include<iostream>
            #include
            <string>
            #include
            <algorithm>
            #include
            <cstdio>
            using namespace std;

            class Student
            {
                
            public:
                    Student():sum_score_(
            0) {}
                    
                    
            string name_;
                    
            int sum_score_;
            };

            bool operator<(const Student &a,const Student &b)
            {
                
            return (a.sum_score_>b.sum_score_ || (a.sum_score_==b.sum_score_ && a.name_<b.name_));
            }

            int main()
            {
                
            /*
                freopen("data.in","r",stdin);
                freopen("data.out","w",stdout);
                //
            */
                
                
            int n,m,g;
                
            while(scanf("%d%d%d",&n,&m,&g)==3 && n)
                {
                    
            int score[17];
                    
            for(int i=0;i<m;i++)
                        scanf(
            "%d",&score[i]);
                    
                    Student stu[
            1007];
                    
            int passed(0);
                    
            for(int i=0;i<n;i++)
                    {
                        
            //  Can not use scanf("%s",stu[i].name_.c_str());
                        cin>>stu[i].name_;
                        
            int solved;
                        scanf(
            "%d",&solved);
                        
            for(int j=0;j<solved;j++)
                        {
                            
            int pro_num;
                            scanf(
            "%d",&pro_num);
                            stu[i].sum_score_
            +=score[pro_num-1];
                        }
                        
            if(stu[i].sum_score_>=g)
                            passed
            ++;
                    }
                    
                    sort(stu,stu
            +n);
                    
                    printf(
            "%d\n",passed);
                    
            for(int i=0;i<passed;i++)
                        printf(
            "%s %d\n",stu[i].name_.c_str(),stu[i].sum_score_);
                }
                
            return 0;
            }
            posted on 2011-02-28 23:05 lee1r 閱讀(538) 評(píng)論(2)  編輯 收藏 引用 所屬分類: 題目分類:基礎(chǔ)/模擬

            FeedBack:
            # re: HDU 1236 排名
            2011-03-05 20:46 | 貝殼里的海
            這代碼看起來(lái)很舒服,哈  回復(fù)  更多評(píng)論
              
            # re: HDU 1236 排名
            2011-04-04 20:36 | starvae
            @貝殼里的海
            哈哈,竟然在這看到你~~  回復(fù)  更多評(píng)論
              
            囯产精品久久久久久久久蜜桃 | 久久国产色AV免费看| 日本久久中文字幕| 久久人人爽人人爽人人片AV麻豆| 久久99热精品| 99久久国产亚洲高清观看2024 | 欧美国产成人久久精品| 久久人妻少妇嫩草AV无码蜜桃| 国产呻吟久久久久久久92| 国产精品免费久久久久影院| 国产福利电影一区二区三区,免费久久久久久久精 | 久久综合狠狠综合久久| 色婷婷综合久久久久中文一区二区| 亚洲AV无码久久寂寞少妇| 久久精品国产亚洲AV大全| 久久综合给合久久国产免费| 99久久免费国产精精品| 久久播电影网| 久久免费看黄a级毛片| 久久99精品久久久久子伦| 久久精品国产精品亚洲精品| 久久国产成人亚洲精品影院| 久久精品国产黑森林| 精品一二三区久久aaa片| www.久久精品| 香蕉久久影院| 国产婷婷成人久久Av免费高清| 99久久国产亚洲高清观看2024| 亚洲精品无码久久久久AV麻豆| 久久久久人妻一区精品性色av| 品成人欧美大片久久国产欧美...| 亚洲午夜精品久久久久久app| 狠狠色综合网站久久久久久久高清 | 久久久久亚洲精品日久生情| 国产情侣久久久久aⅴ免费| 精品久久久无码中文字幕天天| 国产精品一区二区久久精品涩爱| 国产亚洲精品美女久久久| 亚洲天堂久久久| 精品久久久久久无码中文字幕| 狼狼综合久久久久综合网|