|
||||||||||
Image RecognitionTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1590 Accepted Submission(s): 597 Problem Description Now there is an image recognition problem for you. Now you are given an image which is a N * N matrix and there are only 0s and 1s in the matrix. And we are interested in the squares in whose four edges there is no 0s. So it¡¯s your task to find how many such squares in the image. Input The first line of the input contains an integer T (1<=T<=10) which means the number of test cases. For each test cases, the first line is one integer N (1<=N<=1000) which is the size of the image. Then there are N lines and each line has N integers each of which is either 0 or 1. Output For each test case, please output a line which is "Case X: Y", X means the number of the test case and Y means the number of the squares we are interested in in the image. Sample Input
Sample Output
Source | ||||||||||
|