标签:
4 4
0 1 1 1
1 1 1 0
0 1 1 0
1 1 0 1
2
#include<iostream> #include<cstdio> #include<string> #include<cstring> #include<algorithm> using namespace std; int n,m,f[1005][1005],ans; int main(){ cin>>n>>m; for(int i = 1;i <= n;i++){ for(int j = 1;j <= m;j++){ scanf("%d",&f[i][j]); } } for(int i = 1;i <= n;i++){ for(int j = m;j >= 1;j--){ if(f[i][j]) f[i][j] = min(min(f[i-1][j],f[i-1][j+1]),f[i][j+1]) + 1; ans = max(ans,f[i][j]); } } cout<<ans; return 0; }
标签:
原文地址:http://www.cnblogs.com/hyfer/p/5791407.html