80分求助#4#5WA
查看原帖
80分求助#4#5WA
117192
无产者万岁楼主2020/7/10 09:46
#include <bits/stdc++.h>
using namespace std;
int main()
{
	char mp[1001][1001];
	int r,c,k,t,ans=0;
	cin>>r>>c>>k;
	for(int i=1;i<=r;i++)
		for(int j=1;j<=c;j++)
			cin>>mp[i][j];
	for(int i=1;i<=r;i++)
		for(int j=1;j<=c;j++)
			if(mp[i][j]=='.')
			{
				t=0;
				for(int g=i;g<i+k;g++)
					if(mp[g][j]=='.')
						t++;
				if(t==k)
					ans++;
				t=0;
				for(int g=j;g<j+k;g++)
					if(mp[i][g]=='.')
						t++;
				if(t==k)
					ans++;
			}
	cout<<ans;
	return 0;
}
2020/7/10 09:46
加载中...