Skip to content

Instantly share code, notes, and snippets.

@lawrencefmm
Created April 24, 2019 13:52
Show Gist options
  • Save lawrencefmm/ba5d46327668f25950a55d9a66540f8c to your computer and use it in GitHub Desktop.
Save lawrencefmm/ba5d46327668f25950a55d9a66540f8c to your computer and use it in GitHub Desktop.
#include <bits/stdc++.h>
using namespace std;
int main(){
int n;
cin >> n;
int positivos = 0, negativos = 0;
for (int i = 1; i <= n; i++){
int a;
cin >> a;
if (a >= 1) positivos++;
else if (a <= -1) negativos++;
}
if (2*positivos >= n) cout << 1 << "\n";
else if (2*negativos >= n) cout << -1 << "\n";
else cout << 0 << "\n";
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment