#include<bits/stdc++.h>
using namespace std;
int a[101][101];
int b[101][101];
int main()
{
int n,m;cin>>n>>m;
int t;cin>>t;
while(t){
int r,c;
cin>>r>>c;
a[r][c]=1;
t--;
}
int k;cin>>k;
while(k){
for(int i=1;i<=n;++i){
for(int j=1;j<=m;++j){
if(a[i][j]==1){
b[i][j]=b[i-1][j]=b[i][j+1]=b[i][j-1]=b[i+1][j]=1;
}else{
continue;
}
}
}
//将b复制给a
for(int i=1;i<=n;++i){
for(int j=1;j<=m;++j){
a[i][j]=b[i][j];
}
}
k--;
}
int ans=0;
for(int i=1;i<=n;++i){
for(int j=1;j<=m;++j){
if(a[i][j]) ans++;
}
}
cout<<ans<<endl;
return 0;
}
lanqiao OJ551 灌溉
最新推荐文章于 2024-11-06 11:05:01 发布