#include <cstdio>
int a[3005][3005];
char str[3005][3005];
int n, m;
long long ret;
int main(){
scanf("%d %d",&n,&m);
for(int i=1; i<=n; i++){
scanf("%s",str[i] + 1);
}
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
if(str[i][j] == 'B'){
a[i][j] = 0;
}
else{
a[i][j] = a[i-1][j] + a[i][j-1] - a[i-1][j-1] + 1;
}
ret += a[i][j];
}
}
printf("%lld",ret);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
45176 KB |
Output is correct |
2 |
Correct |
0 ms |
45176 KB |
Output is correct |
3 |
Incorrect |
0 ms |
45176 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Halted |
0 ms |
0 KB |
- |