Advertisement
vafin20

Untitled

Jun 11th, 2020
983
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.     int n;
  6.     cin >> n;
  7.     int max = -10000000001;
  8.     int maxNum = -1;
  9.     int zero = -1;
  10.     int countMinus = 0;
  11.     int x;
  12.     for(int i = 1; i < n + 1; ++i) {
  13.         cin >> x;
  14.         if(x == 0)
  15.             zero = i;
  16.         else if (x < 0) {
  17.             ++countMinus;
  18.             if(x > max){
  19.                 max = x;
  20.                 maxNum = i;
  21.             }
  22.         }
  23.     }
  24.     for(int i = 1; i < n + 1; ++i) {
  25.         if(i != zero && (countMinus % 2 == 0 || i != maxNum)) {
  26.             cout << i << endl;
  27.         }
  28.     }
  29.  
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement