/*
Se citeste un vector a cu n elemente intregi. Sa se mute primul element la sfarsitul vectorului.
*/
#include <iostream>
using namespace std;
int main() {
// declaram vectorul,
// o variabila n reprezentand numarul de elemente
// alta variabila prim care retine prima componenta a vectorului
int a[ 100 ],
n,
i,
prim;
cout<<"n = ";
cin>>n;
for(i = 0; i < n; ++i) {
cin>>a[ i ];
}
prim = a[ 0 ];
for(i = 0; i < n - 1; ++i) {
a[ i ] = a[ i + 1 ];
}
a[n - 1] = prim;
for(i = 0; i < n; ++i) {
cout<<a[ i ]<<" ";
}
return 0;
}
LyoKClNlIGNpdGVzdGUgdW4gdmVjdG9yIGEgY3UgbiBlbGVtZW50ZSBpbnRyZWdpLiBTYSBzZSBtdXRlIHByaW11bCBlbGVtZW50IGxhIHNmYXJzaXR1bCB2ZWN0b3J1bHVpLgoKKi8KCiNpbmNsdWRlIDxpb3N0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKCkgewoKICAgIC8vIGRlY2xhcmFtIHZlY3RvcnVsLCAKICAgIC8vIG8gdmFyaWFiaWxhIG4gcmVwcmV6ZW50YW5kIG51bWFydWwgZGUgZWxlbWVudGUKICAgIC8vIGFsdGEgdmFyaWFiaWxhIHByaW0gY2FyZSByZXRpbmUgcHJpbWEgY29tcG9uZW50YSBhIHZlY3RvcnVsdWkKICAgIAogICAgaW50IGFbIDEwMCBdLCAKICAgIAogICAgICAgIG4sIAogICAgICAgIAogICAgICAgIGksIAogICAgICAgIAogICAgICAgIHByaW07CiAgICAKICAgIGNvdXQ8PCJuID0gIjsKICAgIAogICAgY2luPj5uOwogICAgIAogICAgZm9yKGkgPSAwOyBpIDwgbjsgKytpKSB7CiAgICAJCiAgICAJY2luPj5hWyBpIF07CiAgICB9IAogICAgCiAgICBwcmltID0gYVsgMCBdOwogICAgCiAgICBmb3IoaSA9IDA7IGkgPCBuIC0gMTsgKytpKSB7CiAgICAJCiAgICAJYVsgaSBdID0gYVsgaSArIDEgXTsKICAgIH0KICAgIAogICAgYVtuIC0gMV0gPSBwcmltOwogICAgCiAgICBmb3IoaSA9IDA7IGkgPCBuOyArK2kpIHsKICAgIAkKICAgIAljb3V0PDxhWyBpIF08PCIgIjsKICAgIH0KICAgIAogICAgCiAgICAKCXJldHVybiAwOwp9