题目:https://pintia.cn/problem-sets/17/problems/262
题解:https://www.liuchuo.net/archives/522
代码:
#include <iostream> #include <vector> #include <algorithm> using namespace std; int main(){ int n,m; cin>>n>>m; vector<int> a(n); for(int i=0; i<n;i++){ cin>>a[i]; } m= m%n; reverse(begin(a), begin(a)+n); reverse(begin(a), begin(a)+m); reverse(begin(a)+m, end(a)); for(int i=0; i<n-1;i++){ cout<<a[i]<<" "; } cout<<a[n-1]; return 0; }