#include <bits/stdc++.h>
#define ll long long
#define endl "\n"
using namespace std;
ll n,m,a,b,c,d,e;
int main()
{
cin>>n>>m;
char s[n][m];
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
cin>>s[i][j];
}
}
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(s[i][j]==s[i][j+1]){
if(s[i][j]==s[i+1][j]&&s[i][j]==s[i+1][j+1]){
a++;
}
else if(s[i][j]==s[i][j+2]&&s[i][j]==s[i][j+3]){
b++;
}
else if(s[i][j]==s[i+1][j]&&s[i][j]==s[i+1][j-1]){
c++;
}
else if(s[i][j]==s[i+1][j+1]&&s[i][j]==s[i-1][j]){
c++;
}
else if(s[i][j]==s[i+1][j+1]&&s[i][j]==s[i+1][j+2]){
d++;
}
else if(s[i][j]==s[i+1][j]&&s[i][j]==s[i-1][j+1]){
d++;
}
else if(s[i][j]==s[i-1][j+1]&&s[i][j]==s[i][j+2]){
e++;
}
else if(s[i][j]==s[i+1][j+1]&&s[i][j]==s[i][j+2]){
e++;
}
else if(s[i][j]==s[i-1][j]&&s[i][j]==s[i+1][j]){
e++;
}
else if(s[i][j]==s[i-1][j+1]&&s[i][j]==s[i+1][j+1]){
e++;
}
}
else if(s[i][j]==s[i+1][j]&&s[i][j]==s[i+2][j]&&s[i][j]==s[i+3][j]){
b++;
}
}
}
cout<<a<<endl<<b<<endl<<c<<endl<<d<<endl<<e;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
3 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
8 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
9 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
10 |
Correct |
1 ms |
204 KB |
Output is correct |