| 3 | |
| 4 | |
| 5 | int main() { |
| 6 | int a[100][100], max = -324, temp, b[100]; |
| 7 | |
| 8 | for ( int i=0; i<6; i++ ) { |
| 9 | for ( int j=0; j<6; j++ ) { |
| 10 | cin >> a[i][j]; |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | for ( int i=0; i<4; i++ ) { // input matrix is 6x6 and our stride is 3x3, so inorder to cover the whole are we can move at most 4 steps |
| 15 | for ( int j=0; j<4; j++ ) { // rigth and 4 steps down so here i and j is 0 - 3 |
| 16 | temp = a[i][j] + a[i][j+1] + a[i][j+2] + a[i+1][j+1] + a[i+2][j] + a[i+2][j+1] + a[i+2][j+2] ; // this are the position of the matrix we need to clculate |
| 17 | |
| 18 | if ( temp > max ) { //every time we will store the max value compareing to the privous |
| 19 | max = temp; |
| 20 | } |
| 21 | } |
| 22 | } |
| 23 | cout << max << endl; |
| 24 | return 0; |
| 25 | } |
nothing calls this directly
no outgoing calls
no test coverage detected