def main():
first_in = [int(i) for i in input().split(" ")]
num_seats = first_in[2]
rows = [[]] * first_in[0]
for i in range(0, first_in[0]):
rows[i] = list(input())
print(traverse_all(rows, num_seats))
def traverse_all(rows, target):
transposed_rows = zip(*rows)
counter = 0
counter += traverse(rows, target)
if target > 1:
counter += traverse(transposed_rows, target)
return counter
def traverse(rows, target):
counter = 0
for row in rows:
consecutive_seats = "".join(row).split("*")
for seat in consecutive_seats:
seat_len = len(seat)
if seat_len >= target:
counter += 1 + (seat_len - target)
return counter
if __name__ == '__main__':
main()
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
ll test,h,p,i,j,s,xy,n,flag=0,u,count,d,o1=0,o2=0,e,l,r,x,y,m,z,max1,x1,y1,k,x2,y2,z1,z2,sum,min1;
cin>>n>>m>>k;
vector<string>a(n);
for(i=0;i<n;i++){
cin>>a[i];
}
count=0;
vector<vector<ll>>left(n,vector<ll>(m,0)),up(n,vector<ll>(m,0));
for(i=0;i<n;i++){
for(j=0;j<m;j++){
if(a[i][j]=='.'){
left[i][j]++;
up[i][j]++;
if(i){
up[i][j]+=up[i-1][j];
}
if(j){
left[i][j]+=left[i][j-1];
}
if(k==1){
count++;
continue;
}
}
if(left[i][j]>=k){
count++;
}
if(up[i][j]>=k){
count++;
}
}
}
cout<<count<<"\n";
return 0;
}
1702B - Polycarp Writes a String from Memory | 1701A - Grass Field |
489C - Given Length and Sum of Digits | 886B - Vlad and Cafes |
915A - Garden | 356A - Knight Tournament |
1330A - Dreamoon and Ranking Collection | 1692B - All Distinct |
1156C - Match Points | 1675A - Food for Animals |
1328C - Ternary XOR | 1689A - Lex String |
1708B - Difference of GCDs | 863A - Quasi-palindrome |
1478A - Nezzar and Colorful Balls | 1581B - Diameter of Graph |
404A - Valera and X | 908A - New Year and Counting Cards |
146A - Lucky Ticket | 1594C - Make Them Equal |
1676A - Lucky | 1700B - Palindromic Numbers |
702C - Cellular Network | 1672C - Unequal Array |
1706C - Qpwoeirut And The City | 1697A - Parkway Walk |
1505B - DMCA | 478B - Random Teams |
1705C - Mark and His Unfinished Essay | 1401C - Mere Array |