#include <bits/stdc++.h>
using namespace std;
long long h, w;
vector<string> board;
vector<long long> row, col;
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
cin >> h >> w;
board.resize(h);
for (int i = 0; i < h; i++) {
cin >> board[i];
}
long long ans = 0;
for(long long i=0;i<h;i++)
{
for(long long k=i+1;k<h;k++)
{
for(long long j=0;j<w;j++)
{
if(board[i][j]== 'J' && board[k][j] == 'I')
{
for(long long l=j+1;l<w;l++)
{
if(board[i][l] == 'O')
{
ans++;
}
}
}
}
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |