0
已采纳
意思就是第m小的数字
比如说这里有一串数字:
1 2 3
而第一小的就是1,因为1最小
第二小的就是2,第三小的就是3
而题目中的1 3 3 7 2 5 1 2 4 6
他要找第三小的
而这一串中又1和2占了第一小和第二小
那么这个串中的第三小就是3
打字不易,望采纳
0
被禁言


修练者
#include<bits/stdc++.h>
using namespace std;
bool tong[30005];
int main()
{
int m,n;
cin>>n>>m;
for(int i=1;i<=n;i++)
{
int t;
cin>>t;
tong[t]=true;
}
int cnt=0;
for(int i=1;i<=n;i++)
{
if(tong[i])
{
cnt++;
}
if(cnt==m)
{
cout<<i;
return 0;
}
}
cout<<"NO RESULT";
return 0;
}
80分!!!