题解
2025-08-02 19:55:49
发布于:浙江
2阅读
0回复
0点赞
要用set操作喔!
#include<iostream>
#include<set>
using namespace std;
int main(){
int t;
cin>>t;
while(t--){
set<int> st;
int n;
cin>>n;
while(n--){
int x;
cin>>x;
st.insert(x);
}
if (st.size()<2){
cout<<"NO"<<endl;
}else{
st.erase(st.begin());
cout<<*st.begin()<<endl;
}
}
}
这里空空如也
有帮助,赞一个