Created
December 11, 2016 13:49
-
-
Save tsuzu/62d4c0f7f8f5356e27a80e8df98b5b88 to your computer and use it in GitHub Desktop.
JOI 2017 Yo 3rd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <algorithm> | |
#include <vector> | |
#include <functional> | |
#include <queue> | |
#include <cmath> | |
#include <cstring> | |
int n, m, d; | |
char arr[110][110]; | |
int main() { | |
std::cin >> n >> m >> d; | |
for(int i = 0; i < n; ++i) { | |
for(int j = 0; j < m; ++j) { | |
char c; | |
std::cin >> c; | |
arr[i][j] = c; | |
} | |
} | |
int ans = 0; | |
for(int i = 0; i < n; ++i) { | |
for(int j = 0; j < m; ++j) { | |
bool flag = true; | |
for(int k = 0; k < d; ++k) { | |
if(arr[i][j + k] == '#' || j + k >= m) { | |
flag = false; | |
break; | |
} | |
} | |
if(flag) | |
++ans; | |
flag = true; | |
for(int k = 0; k < d; ++k) { | |
if(arr[i + k][j] == '#' || i + k >= n) { | |
flag = false; | |
break; | |
} | |
} | |
if(flag) | |
++ans; | |
} | |
} | |
std::cout << ans << std::endl; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment