fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int t;
  7. cin>>t;
  8. while(t--){
  9. int n;
  10. cin>>n;
  11. int a[n];
  12. for(int i=0;i<n;i++){
  13. cin>>a[i];
  14. }
  15. int m;
  16. cin>>m;
  17. for(int i=0;i<m;i++){
  18. int temp=0;
  19. temp=a[n-1];
  20. for(int j=n-1;j>0;j--){
  21. a[j]=a[j-1];
  22. }
  23. a[0]=temp;
  24. }
  25. for(int i=0;i<n;i++){
  26. cout<<a[i];
  27. }
  28. cout<<"\n";
  29.  
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5456KB
stdin
2
5
1 2 3 4 5
1
4
1 3 5 7
2
stdout
51234
5713