Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int m=5, n=3;
- int a[m][n];
- for (int i = 0; i < m; ++i){
- for (int j = 0; j < n; ++j){
- a[i][j] = 4-i-j*2;
- cout<<a[i][j]<<'\t';}
- cout<<endl;
- }
- int min, max;
- max = min = a[m/2][n/2];
- bool cond_min, cond_max;
- cond_min, cond_max = 0;
- for (int j, i = 0; i < m; ++i){
- for (j = 0 ; j < n; ++j)
- if (a[i][j]%2 != 0) break;
- if (j == n) {
- cond_min = true;
- for (int j = 0; j < n; ++j)
- min = a[i][j] < min ? a[i][j]:min;
- }
- else continue;
- }
- if (cond_min == 1) cout << "min="<<min<<endl;
- else cout << "netu_min"<<endl;
- int chet, nech;
- for (int j = 0, chet = 0, nech = 0 ; j < n; ++j){
- for (int i = 0 ; i < m; ++i){
- if (a[i][j]%2 == 0) chet+=1;
- else nech+=1;
- }
- if (chet>nech) {
- cond_max = true;
- for (int i = 0; i < m; ++i)
- max = a[i][j] > max ? a[i][j]:max;
- }
- else continue;
- }
- if (cond_max == 1) cout << "max=" <<max<<endl;
- else cout << "netu_max"<<endl;
- if (cond_min * cond_max == 1) cout<<"z="<<min + max<<endl;
- else cout<<"netu_z"<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement