- 数学
sb
- 2024-1-22 19:13:21 @
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n=0,k=0,hao[101];
double fen[101]={0};
cin>>n>>k;
for(int i=1;i<=n;i++)
{
int a=0;
double b=0;
cin>>a>>b;
hao[i]=a;
fen[i]=b;
for(int j=1;j<i;j++)
{
if(b>fen[j])
{
for(int ii=i;ii>j;ii--)
{
fen[ii]=fen[ii-1];
hao[ii]=hao[ii-1];
}
hao[j]=a;
fen[j]=b;
break;
}
}
}
cout<<hao[k]<<" "<<fen[k]<<endl;
return 0;
}
0 comments
No comments so far...