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]<<" ";}
- cout<<endl;
- }
- int min, max;
- bool cond_1, cond_2;
- cond_1, cond_2 = 0;
- for (int i = 0, j, _min; i < m; ++i){
- _min = cond_1 ? min:a[i][0];
- for (j = 0 ; j < n; ++j){
- if (a[i][j]%2 != 0) break;
- _min = a[i][j] < _min ? a[i][j]:_min;
- }
- if (j==n) {
- min = _min;
- cond_1 = true;
- }
- }
- if (cond_1) cout << "min="<<min<<endl;
- else cout << "netu_min"<<endl;
- for (int j = 0, chet = 0, nech = 0, _max ; j < n; ++j){
- _max = cond_2 ? max:a[0][j];
- for (int i = 0 ; i < m; ++i){
- _max = a[i][j] > _max ? a[i][j]:_max;
- if (a[i][j]%2 == 0) chet++;
- else nech++;
- }
- if (chet>nech) {
- cond_2 = true;
- max = _max;
- }
- }
- if (cond_2) cout << "max=" <<max<<endl;
- else cout << "netu_max"<<endl;
- if (cond_1 && cond_2) cout<<"z="<<min + max<<endl;
- else cout<<"netu_z"<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement