Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Created September 16, 2017 15:03
#include <iostream.h>
int verif(int a[100], int n) {
int p = 0;
for (int i = 1; i <= n; i++)
if (a[i] <= 0)
p--;
else if (a[i] >= 0)
p++;
if (p < 0)
return -1;
else if (p > 0)
return 1;
else
return 0;
}
void main() {
int n, i, a[100];
cin >> n;
for (i = 1; i <= n; i++)
cin >> a[i];
cout << verif(a, n);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment