433 afișări Tudurachi Călin (colan007) 05.12.2023 www.pbinfo.ro
Etichete: nicio etichetă

#include <fstream>
#include <climits>
using namespace std;
ifstream fin (“mouse.in”);
ofstream fout (“mouse.out”);

const int nMAX = 100;
const int mMAX = 100;

int n, m;
int mat[nMAX + 1][mMAX + 1];

int main()
{ fin >> n >> m;

int sum = 0, minim = INT_MAX; for (int i = 1; i <= n; ++i) for (int j = 1; j <= m; ++j) { fin >> mat[i][j]; sum += mat[i][j]; if ( (i & 1 || j & 1) && (i != 1 || j != 1) && (i != n || j != m)) minim = min(minim, mat[i][j]); } if (n % 2 0 && m % 2 0) { fout << n * m – 1 << ‘ ‘ << sum – minim; } else fout << n * m << ‘ ‘ << sum; }

433 afișări Tudurachi Călin (colan007) 05.12.2023 www.pbinfo.ro