------------------------------------
This problem has a hole, the title description is ambiguous, the level of the question is not very good ah ....
The cross must be made up of 1, and it is 5, not a large cross.
The AC code is as follows:
1 ImportJava.util.Scanner;2 3 Public classMain {4 5 Public Static voidMain (string[] args) {6 7Scanner sc=NewScanner (system.in);8 9 inttimes=sc.nextint ();Ten while(times-->0){ Onematrix=New int[w][w]; A for(inti=0;i<w;i++){ - for(intj=0;j<w;j++){ -matrix[i][j]=sc.nextint (); the } - } - - System.out.println (Dfs ()); + } - + } A at Private Static intMatrix[][],w=7; - - Private Static intDfs () { - intAns=0; - for(inti=1;i<w;i++){ - for(intj=1;j<w;j++){ in if(Iscross (i,j)) ans++; - } to } + returnans; - } the * Private Static BooleanIscross (intXinty) { $ if(x<1 | | x>=w-1 | | y<1 | | y>=w-1)return false;Panax Notoginseng if(matrix[x][y]!=1)return false; - return1==matrix[x-1][y] && 1==matrix[x+1][y] && 1==matrix[x][y-1] && 1==matrix[x][y+1]; the } + A}
Title Source: http://acm.nyist.net/JudgeOnline/problem.php?pid=893
Nyoj Topic 8,930-word Rack