牛客竞赛1 D

Determine the Photo Position

/*
遍历每一行,找出连续0的个数cot,ans+=max(0,cot-m+1)
*/#include 
using namespace std;
int t;
const int maxn=2005;
string s[maxn];
int main()
{int n,m;cin>>n>>m;for(int i=0;i<n;i++){cin>>s[i];		}string s2;cin>>s2;int ans=0;for(int i=0;i<n;i++){int j=0;while(j<n)//遍历一行{int cot=0;while(s[i][j]=='0')//找连续0个数{cot++;j++;}//cout<ans+=max(0,cot-m+1);j++;}} cout<<ans<<endl; }


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部