为什么只能输入一次
#include<bits/stdc++.h>
using namespace std;
struct xs
{
int xh;
int fs;
bool operator > (const xs &x)const
{
return fs>x.fs;
}
void operator ^ (xs &x)
{
fs=x.fs;
xh=x.xh;
}
} xsm[105];
void swap1(xs a,xs b)
{
xs temp;
temp^a;
a^b;
b^temp;
}
int n,k;
int main()
{
cin>>n;
cin>>k;
for(int i=1;i<=n;i++)
{
cin>>xsm[i].xh;
cin>>xsm[i].fs;
}
for(int i=n;i>=1;i--)
{
for(int j=1;j<i;j++)
{
if(xsm[j]>xsm[j+1])
{
swap1(xsm[j],xsm[j+1]);
}
}
}
cout<<xsm[k].xh<<" "<<xsm[k].fs;
return 0;
}