fork(1) download
  1. #include<iostream>
  2. #include<vector>
  3. #include<algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main(){
  8. vector <int> v;
  9. int x, c=0, s=0, y;
  10.  
  11. while(cin>>x)
  12. v.push_back(x);
  13.  
  14. do
  15. if (
  16. rotate(v.begin(),v.begin()+1,v.end()),
  17. c++,
  18. is_sorted(v.begin(),v.end())
  19. ) s = 1;
  20. while(!s & c <= v.size());
  21.  
  22. if (s)
  23. for(y=0; y<v.size(); y++)
  24. cout<<v[y]<<" ";
  25. else
  26. cout<<"False";
  27. }
  28.  
Success #stdin #stdout 0s 3420KB
stdin
7 10 2 3 4
stdout
2 3 4 7 10