import java.util.Scanner;
public class P3654 {
static int R,C,K,count=0;
static char[][] grid = new char[100][100];
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
R = sc.nextInt();
C = sc.nextInt();
K = sc.nextInt();
for(int i=0;i<R;i++) {
grid[i] = sc.next().toCharArray();
}
get();
System.out.println(count);
}
private static void get() {
boolean flag ;
for(int i=0;i<R;i++) {
for(int j=0;j<C;j++) {
flag = true;
for(int s=0;s<K;s++) {
if((i+s)>=R||grid[i+s][j] != '.') {
flag = false;
break;
}
}
if(flag==true) {
count++;
}
flag = true;
for(int s=0;s<K;s++) {
if((j+s)>=C||grid[i][j+s] != '.') {
flag = false;
break;
}
}
if(flag==true) {
count++;
}
}
}
if(K==1) {
count /= 2;
}
}
}
P3654 First Step (遍历枚举)
猜你喜欢
转载自blog.csdn.net/qq_28635317/article/details/114893333
今日推荐
周排行