SHARE
TWEET

123

a guest Oct 21st, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. double n, m, suma=0,prosek,brElemenata, niz[100][100],mx=0;
  4. int main() {
  5. cin >> n >> m;
  6. for (int i = 1; i <= n; i++) {
  7.     for (int j = 1; j <= m; j++) {
  8.         cin >> niz[i][j];
  9.     }
  10. }
  11.  
  12. for (int i = 1; i <= n; i++) {
  13.     for (int j = 1; j <= m; j++) {
  14.         if (i%2==0) {
  15.             suma+=niz[i][j];
  16.             brElemenata++;
  17.         }
  18.         if (j%2!=0) {
  19.             mx = max(mx, niz[j][i]);
  20.         }
  21.     }
  22. }
  23. double prosek = suma/brElemenata;
  24. cout << prosek << "\n" << mx;
  25. ///////////////////////////////////////
  26.  
  27.  
  28.  
  29.  
  30.  
  31. return 0;
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top