You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# include <iostream>
# include <math.h>
# include <cstring>
using namespace std ;
int x [ 601 ] [ 601 ] ;
int F [ 601 ] [ 601 ] ;
int line [ 601 ] = { 0 } ;
/*
一维index表示行数, 二维index表示列数
*/
int main ( )
{
int n , L , r , t ;
cin > > n > > L > > r > > t ;
for ( int i = 0 ; i < = n ; i + + )
{
memset ( line , 0 , sizeof ( line ) ) ;
for ( int j = 0 ; j < = n ; j + + )
{
if ( i = = 0 | | j = = 0 )
F [ i ] [ j ] = 0 ;
else
{
cin > > x [ i ] [ j ] ;
line [ j ] = line [ j - 1 ] + x [ i ] [ j ] ;
F [ i ] [ j ] = line [ j ] + F [ i - 1 ] [ j ] ;
}
}
}
// for (int i = 0; i <= n; i++)
// {
// for (int j = 0; j <= n; j++)
// {
// cout << F[i][j] << " ";
// }
// cout << endl;
// }
int count = 0 ;
for ( int i = 1 ; i < = n ; i + + )
{
for ( int j = 1 ; j < = n ; j + + )
{
int i_up = ( i - r - 1 > 0 ) ? i - r - 1 : 0 ;
int i_down = ( i + r < = n ) ? i + r : n ;
int j_left = ( j - r - 1 > 0 ) ? j - r - 1 : 0 ;
int j_right = ( j + r < = n ) ? j + r : n ;
double average = ( F [ i_down ] [ j_right ] + F [ i_up ] [ j_left ] - F [ i_down ] [ j_left ] - F [ i_up ] [ j_right ] ) ;
// cout << average << " ";
// cout << (i_down - i_up) * (j_right - j_left) << " ";
// if ((i_down - i_up) * (j_right - j_left) == 24)
// {
// cout << i << " " << j << " " << r << endl;
// }
average = average / ( i_down - i_up ) / ( j_right - j_left ) ;
if ( average < = t )
count + + ;
}
// cout << endl;
}
cout < < count ;
return 0 ;
}