You are viewing a single comment's thread. Return to all comments →
You're over-complicating things with two loops and C arrays in C++.
int n, d;
cin >> n >> d;
vector<int> v((istream_iterator<int>(cin)), istream_iterator<int>());
for (int i = 0; i < n; ++i) cout << v[(i + d) % n] << " ";
Using 2 loops is not overcomplicating. Overcomplicating is your "code". I would be angry for my emloyee if he writes such code like yours. Looking at 2 loops everybody gets in mere second what is going on. Looking at your code one needs to waste much more time figuring out what is going on there.