Advertisement
Guest User

Untitled

a guest
Dec 17th, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. int n;
  7. cin>>n;
  8.  
  9. if(n%4==0){
  10. cout<<0<<'\n';
  11. cout<<n/2<<' ';
  12. }
  13. else if(n%4==1){
  14. cout<<1<<'\n';
  15. cout<<n/2+1<<' ';
  16. }
  17. else if(n%4==2){
  18. cout<<1<<'\n';
  19. cout<<n/2<<' ';
  20. }
  21. else if(n%4==3){
  22. cout<<0<<'\n';
  23. cout<<n/2<<' ';
  24. }
  25.  
  26. int K=n;
  27.  
  28. while(n!=0){
  29. if((K-n)%4==0 || (K-n)%4==3){
  30. cout<<n<<' ';
  31. }
  32. n--;
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement