upload
This commit is contained in:
commit
810a9654a4
50 changed files with 4450 additions and 0 deletions
22
2/D.cpp
Normal file
22
2/D.cpp
Normal file
|
@ -0,0 +1,22 @@
|
|||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
int n;
|
||||
std::cin >> n;
|
||||
int* a = new int[n];
|
||||
|
||||
for (int i = 1; i <= n; ++i) {
|
||||
a[i-1] = i;
|
||||
}
|
||||
|
||||
for (int i = 2; i < n; ++i) {
|
||||
std::swap(a[i], a[i/2]);
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; ++i) {
|
||||
std::cout << a[i] << " ";
|
||||
}
|
||||
|
||||
delete[] a;
|
||||
return 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue