| 记录编号 | 
        44173 | 
        评测结果 | 
        AAAAAAAAAA | 
    
    
        | 题目名称 | 
        1165.家族 | 
        最终得分 | 
        100 | 
            
    
    
        | 用户昵称 | 
         TBK | 
        是否通过 | 
        通过 | 
    
    
        | 代码语言 | 
        C++ | 
        运行时间 | 
        0.010 s  | 
    
    
        | 提交时间 | 
        2012-10-17 08:23:09 | 
        内存使用 | 
        3.99 MiB  | 
        
    
    
    
    		显示代码纯文本
		
		#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <string>
#include <set>
#include <algorithm>
#define MAXN 0x7fffffff
using namespace std;
int a[100][211],b,c,d,l[100],m,n,r[4][2]={{-1,0},{1,0},{0,1},{0,-1}},p[100000][2],h,t,x,y,z,s;
string str,str1;
int main(void) 
{
    freopen("family.in", "r", stdin);
    freopen("family.out", "w", stdout);
    cin>>b;
    getline(cin,str);
    while (d!=b)
    {
        getline(cin,str);
        l[d]=str.length();
        for (c=0;c<str.length();c++)
            if (str[c]=='*'||str[c]==' '||str[c]==10||str[c]==13) a[d][c]=0;
				else a[d][c]=1;
        d++;
    }
    for (c=0;c<b;c++)
        for (m=0;m<l[c];m++)
            if (a[c][m]==1) 
            {
                h=0;
                t=0;
                a[c][m]=0;
                s++;
                p[h][0]=c;
                p[h][1]=m;
                h++;
                while (h>t)
                {
                    for (n=0;n<4;n++)
                    {
                        x=p[t][0]+r[n][0];
                        y=p[t][1]+r[n][1];
                        if (x>=0&&x<b)
                        {
							if (a[x][y]==1) 
							{
								a[x][y]=0;
								p[h][0]=x;
								p[h][1]=y;
								h++;
							}
						}
                    }
                    t++;
                }
            }
    printf("%d",s);
    fclose(stdin);
    fclose(stdout);
    return 0;
}