• <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>
            #include <stdio.h>
            #include 
            <string.h>
            #include 
            <stdlib.h>

            #define  N 510

            struct  Stu
            {
                
            int   height;
                
            char  sex[5];
                
            char  music[110];
                
            char  sport[110];
            }
            ;

            Stu    p[N];
            bool   map[N][N];
            int    match[N];
            bool   visite[N];
            int    id[N];
            int    n,m,t;

            bool isok( Stu const& a, Stu const& b )
            {
                
            return  abs( a.height- b.height )<= 40 && strcmp(a.music,b.music )== 0 && strcmp(a.sport,b.sport )!= 0 ;
            }


            int  abs( int const& a )
            {
                
            return a> 0? a: -a;
            }


            void build()
            {
                n
            = 0, m= 0;
                memset( map, 
            falsesizeof(map) );
                memset( match, 
            -1sizeof(match) );
                
                
            forint i= 0; i< t; ++i )
                
            {
                    
            if( p[i].sex[0]== 'M' )  id[i]= n++;
                    
            else                     id[i]= m++;
                }

                
                
            forint i= 0; i< t; ++i )
                    
            forint j= 0; j< t; ++j )
                    
            if( p[i].sex[0]== 'M' && p[j].sex[0]== 'F'  &&  isok( p[i], p[j] ) )
                        map[ id[i] ][ id[j] ]
            = true;
            }


            bool dfs( int p )
            {
                
            forint i= 0; i< m; ++i )
                
            if!visite[i] && map[p][i] )
                
            {
                    visite[i]
            = true;
                    
                    
            int t= match[i];
                    match[i]
            = p;
                    
                    
            if( t== -1 || dfs(t) )  return true;
                    match[i]
            = t;
                }

                
                
            return false;
            }


            int Match()
            {
                
            int ret= 0;
                
                
            forint i= 0; i< n; ++i )
                
            {
                    memset( visite, 
            falsesizeof(visite) );
                    
                    
            if( dfs(i) )  ret++;
                }

                
                
            return ret;
            }


            int main()
            {
                
            int test;
                scanf(
            "%d"&test );
                
                
            while( test-- )
                
            {
                    scanf(
            "%d"&t );
                    
                    
            forint i= 0; i< t; ++i )
                        scanf(
            "%d %s %s %s"&p[i].height, p[i].sex, p[i].music, p[i].sport );
                        
                    build();
                    printf(
            "%d\n", t- Match() );
                }

                
                
            return 0;
            }

            posted on 2008-11-05 12:05 Darren 閱讀(299) 評論(1)  編輯 收藏 引用

            評論:
            # re: Pku 2771 Guardian of Decency 2010-03-18 15:09 | 松島楓
            總提示非法的char constant,是什么原因?
              回復  更多評論
              
            亚洲欧美一级久久精品| 香蕉aa三级久久毛片| 久久久无码人妻精品无码| 一本久道久久综合狠狠爱| 久久国产精品成人片免费| 天天爽天天爽天天片a久久网| 久久99精品国产麻豆婷婷| 国内精品久久久久影院老司| 久久婷婷五月综合色奶水99啪| 中文字幕亚洲综合久久| 偷偷做久久久久网站| 久久久精品免费国产四虎| 偷偷做久久久久网站| 国产高潮久久免费观看| 麻豆成人久久精品二区三区免费| 国产精品无码久久久久| 亚洲综合熟女久久久30p| 久久精品成人免费国产片小草 | 国产精品久久网| 久久国产香蕉视频| 精品国产一区二区三区久久久狼| 亚洲欧美一级久久精品| 国产综合成人久久大片91| 久久99精品久久久久久动态图| 色综合久久天天综线观看| 国产精品狼人久久久久影院| 国产三级久久久精品麻豆三级| 国产精品久久久久蜜芽| 久久无码国产| 国产精品热久久毛片| 久久综合九色综合精品| 97r久久精品国产99国产精| 无码伊人66久久大杳蕉网站谷歌 | 精品久久久中文字幕人妻| 久久精品成人免费国产片小草| 99久久亚洲综合精品成人| 国产精品一区二区久久精品| 99久久国产热无码精品免费| 久久这里只有精品18| 久久婷婷成人综合色综合| 久久久久亚洲AV无码网站|