#include <bits/stdc++.h> using namespace std; int main(){ int a[105]={},n,b; cin>>n; for(int i=1;i<=n;i++){ cin>>b; a[b+50]++; } for(int i=-50;i<=50;i++){ if(a[i+50]>n/2){ cout<<i; return 0; } } cout<<"no"; return 0; }
标签:std,一半,超过,50,次数,int,main From: https://www.cnblogs.com/w6826301/p/17598848.html