水题
<span style="font-size:14px;">#include<iostream>
#include<cmath>
using namespace std;
#define MAX_N 105
int N;
int a[MAX_N];
int cnt = 1;
void solve(){
bool flag = false;
int cnt2 = 0;
if(a[0] > 0){ //朝右
for(int i = 1; i < N; ++i){
if(a[i] < 0 && abs(a[i]) > a[0]){
flag = true;
cnt++;
}else if(a[i] > 0 && a[i] < a[0]){
cnt2++;
}
}
}else{
for(int i = 1; i < N; ++i){
if(a[i] > 0 && a[i] < abs(a[0])){
flag = true;
cnt++;
}else if(a[i] < 0 && abs(a[i]) > abs(a[0])){
cnt2++;
}
}
}
if(flag)
cnt += cnt2;
cout << cnt << endl;
}
int main()
{
while(cin >> N){
for(int i = 0 ; i < N; ++i){
cin >> a[i];
}
cnt = 1;
solve();
}
return 0;
}
</span>