1 条题解
-
0莫言 (slz莫言) LV 10 @ 2024-11-30 11:58:32
#include <bits/stdc++.h> #define LL long long using namespace std; const int N = 1000 + 10; const int INF = 0x3f3f3f3f; int n , m; int a [N]; int main() { cin >> m >> n; for (int i = 1; i <= n; i++) cin >> a [i]; if ( m == 1 ) sort (a + 1 , a + n + 1); else sort (a + 1 , a + n + 1 , greater <int> ()); for (int i = 1; i < n; i++) cout << a [i] << ","; cout << a [n]; return 0; }
- 1
信息
- ID
- 3087
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 2
- 标签
- (无)
- 递交数
- 77
- 已通过
- 14
- 上传者