参考:https://blog.csdn.net/zhongyuchen/article/details/77478039
1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <algorithm> 5 using namespace std; 6 const int N=210; 7 int n; 8 int in[N]; 9 int main() 10 { 11 while (cin>>n) 12 { 13 for (int i=0;i<2*n;i++) 14 { 15 cin>>in[i]; 16 } 17 sort(in,in+2*n); 18 if (in[n]>in[n-1]) 19 { 20 cout<<"YES"<<endl;//注意YES不要写错! 21 } 22 else 23 { 24 cout<<"NO"<<endl; 25 } 26 } 27 28 return 0; 29 }