Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- #include <vector>
- #include <algorithm>
- #include <iterator>
- #include <sstream>
- using namespace std;
- istream & operator >> (istream & in, vector<long long int> & v)
- {
- string str;
- getline(in,str);
- stringstream stream(str);
- int tmp;
- while(stream >> tmp)
- v.push_back(tmp);
- return in;
- }
- ostream & operator << (ostream & out, vector<long long int> const & v)
- {
- for(long long int el: v)
- out << el << ' ';
- return out;
- }
- int main()
- {
- long long int i,n,x,m,k,j,t,b,ma,mi;
- vector<long long int> a;
- cin>>a;
- cin>>k;
- b=k%a.size();
- if (k>0){
- for(i=a.size()-b;i<a.size();++i)
- cout<<a[i]<<" ";
- for(i=0;i<a.size()-b;++i)
- {
- cout<<a[i]<<" ";
- }
- }
- if (k<0){
- b=abs(b);
- for(i=b;i<a.size();++i)
- {
- cout<<a[i]<<" ";
- }
- for(i=0;i<b;++i)
- {
- cout<<a[i]<<" ";
- }
- }
- if (k==0) cout<<a;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement