Răspuns:
#include <iostream>
#include <fstream>
using namespace std;
ifstream f("date.in");
ofstream g("date.out");
int main()
{
int n,i;
f >> n;
int p=n+1;
int v[p];
for (i=1; i<=n; i++) f >> v[i];
int a=1, j;
while (a<=n) {
for (i=a; i<=n; i++) g << v[i] << " ";
for (j=1; j<a; j++) g << v[j] << " ";
g << endl;
++a;
}
return 0;
}
Explicație: