You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
433 B
18 lines
433 B
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
const int INF = 0x3f3f3f3f;
|
|
typedef long long LL;
|
|
int a[] = {4, 1, 9, 5, 1, 7, 2};
|
|
|
|
int main() {
|
|
int len = sizeof(a) / 4;
|
|
for (int i = 0; i < len - 1; i++) {
|
|
int mi = i;
|
|
for (int j = i + 1; j < len; j++)
|
|
if (a[j] < a[mi]) mi = j;
|
|
swap(a[i], a[mi]);
|
|
}
|
|
for (int i = 0; i < len; i++) printf("%d ", a[i]);
|
|
return 0;
|
|
} |