1 条题解
-
1huhe (刘弘晖) LV 7 @ 2022-1-7 18:30:30
/***************************************** 备注: ******************************************/ #include <queue> #include <math.h> #include <stack> #include <stdio.h> #include <iostream> #include <vector> #include <iomanip> #include <string.h> #include <algorithm> using namespace std; #define LL long long const int N = 1e5 + 10; const int INF = 0x3f3f3f3f; int a[N]; int main() { int n; n = 10; for(int i = 0 ; i < n ; i++) { cin >> a[i]; } for(int i = 0 ; i < n ; i++) { int id = i; for(int j = i + 1 ; j < n ;j++) { if(a[id] > a[j]) id = j; } if(id != i) swap(a[i],a[id]); } for(int i = n-1 ; i >= 0 ; i--) cout << a[i] << " "; return 0; }
- 1
信息
- ID
- 1250
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- 6
- 标签
- 递交数
- 311
- 已通过
- 94
- 上传者