#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define pf push_front
#define pob pop_back
#define pof pop_front
#define F first
#define S second
typedef pair<int, int> PII;
const int KMX = 1e2 + 10, MOD = 1e9 + 7, inf = 3e18, ninf = -3e18;
string s[KMX];
int32_t main(){
ios_base::sync_with_stdio(false);
cin.tie();
int n, m;
cin >> n >> m;
for(int i = 0; i < n; i++){
cin >> s[i];
}
int ans = 0;
for(int i = 0; i < n; i++){
for(int j = 0; j < m ; j++){
bool tf = (s[i][j] == '*');
tf &= (j ? s[i][j - 1] == '.' : 1);
tf &= (i ? s[i - 1][j] == '.' : 1);
if(tf)
ans++;
}
}
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
376 KB |
Output is correct |
2 |
Correct |
5 ms |
252 KB |
Output is correct |
3 |
Correct |
5 ms |
380 KB |
Output is correct |
4 |
Correct |
5 ms |
376 KB |
Output is correct |
5 |
Correct |
5 ms |
376 KB |
Output is correct |
6 |
Correct |
5 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
5 ms |
376 KB |
Output is correct |
9 |
Correct |
5 ms |
376 KB |
Output is correct |
10 |
Correct |
5 ms |
376 KB |
Output is correct |