注意在代码中
AC代码如下:
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <algorithm>
using namespace std;
int N, M;
int temp, num[1001][1001];
int height[1010];
char t[1010];
int main(){
while( scanf( "%d%d", &N, &M ) != EOF ){
memset( num, 0, sizeof( num ) );
for( int i = 1; i <= N; i++ ){
scanf( "%s", t + 1 );
for( int j = 1; j <= M; j++ ){
temp = t[j] - '0';
if( 1 == temp ){
num[i][j] = num[i-1][j] + 1;
}else{
num[i][j] = 0;
}
}
}
int ans = 0;
for( int i = 1; i <= N; i++ ){
memset( height, 0, sizeof( height ) );
for( int j = 1; j <= M; j++ ){
height[num[i][j]]++;
}
int temp = 0;
for( int j = 1000; j >= 1; j-- ){
temp += height[j];
ans = max( ans, temp * j );//这里要注意 应该是大于等于hight[j] 的而不只是height[j]
}
}
cout << ans << endl;
}
return 0;
}