- 求第 k 大数
错哪里了啊啊啊啊
- 2024-1-3 17:47:23 @
#include <bits/stdc++.h>
using namespace std;
int a[10001];
int main()
{
int c,b=0,d,e=1;
cin>>c>>d;
for(int i=0;i<c;i++)
{
cin>>a[i];
}
for(int j=0;j<c;j++)
{
if(a[j]>b)b=a[j];
}
if(d==1)
{
cout<<b;
return 0;
}
for(int n=0;n<d;n++)
{
for(int m=0;m<c;m++)
{
int v=b-e;
if(a[m]==v)
{
b=v;
break;
}
e++;
}
}
cout<<b;
return 0;
}
0 comments
No comments so far...
Information
- ID
- 1241
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 3
- Tags
- # Submissions
- 43
- Accepted
- 23
- Uploaded By