Răspuns :
#include <iostream>
using namespace std;
int main(){
int n,i;
int a[100];
int b[200];
cout << "Introduceti n : ";
cin >> n;
for (i=1;i<=n;i++) a[i] = i;
int mod = 1;
int putere = n;
int predec = 1;
while (putere>0){
if (mod==1){
for (i=1;i<=putere;i++){
b[i+predec] = a[n-putere + i];
}
}
else {
for (i=1;i<=putere;i++){
b[i+predec] = a[n+1-i];
}
}
predec = predec + putere;
putere = putere/2;
mod = mod * -1;
}
for(i=2;i<=predec;i++) cout << b[i] << " ";
int poz;
cout << "\nPozitie : ";
cin >> poz;
cout << "Elementul de pe pozitia " << poz << " = " << b[poz+1];
}