package cn.withe;
public class Count {
public static int staticpoint=0;
public static int points[]=new int[11];
public final static int MAXCOL=10;
public final static int MAXROW=10;
public static int[][] number={
{1,1,1,1,1,0,0,0,0,0},
{1,1,1,0,0,0,1,1,1,1},
{0,0,1,1,0,0,0,0,0,0},
{1,1,0,1,1,0,1,1,0,1},
{0,1,0,1,0,1,1,0,0,1},
{1,1,1,1,0,0,0,0,0,0},
{0,0,0,0,0,1,1,1,1,1},
{1,1,1,1,1,0,0,0,0,0},
{1,1,0,0,0,0,1,1,1,1},
{1,1,1,1,0,0,0,0,1,1}
};
public static void check(int row,int col)
{
if(number[row][col]==0) return;
else
{
points[staticpoint]++;
number[row][col]=0;
if(row>0) check(row-1,col);
if(row if(col>0) check(row,col-1);
if(col }
}
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
for(int i=0;i for(int j=0;j {
if(number[i][j]==1)
{
staticpoint++;
points[staticpoint]=0;
check(i,j);
}
}
for(int i=1;i<=10;i++)
{
System.out.println("NO"+i+":"+points[i]);
}
}
}
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/219138/viewspace-915319/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/219138/viewspace-915319/