提交时间:2023-11-10 20:04:59
运行 ID: 109636
#include <bits/stdc++.h> using namespace std; const int N=1e5+10; const int INF=0x3f3f3f3f; int n,k; struct node{ int sum,s; }a[N]; bool cmp(node x,node y) { return x.sum<=y.sum; } int main() { cin>>n>>k; for(int i=1;i<=n;i++) { cin>>a[i].sum; a[i].s = i; } sort(a+1,a+n+1,cmp); cout<<a[k].s; return 0; }