Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
20768 | LeoWang | 求第k大数 | C++ | Accepted | 0 MS | 236 KB | 397 | 2023-06-20 08:10:05 |
#include<iostream> using namespace std; int main() { int n,t; cin>>n; int a[n]; for(int i=0;i<n;i++) { cin>>a[i]; } for(int i=0;i<n;i++) { for(int j=0;j<n;j++) { if(a[i]>a[j]) { t=a[i]; a[i]=a[j]; a[j]=t; } } } cout<<a[t-1]; return 0; }