Advertisement
a53

bile

a53
Jul 9th, 2017
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #include <fstream>
  2.  
  3. using namespace std;
  4. ifstream f("bile.in");
  5. ofstream g("bile.out");
  6. long int n;
  7.  
  8. int main()
  9. {
  10. f>>n;
  11. long int n1,n2,n3,n4;
  12. if(n%2==0)
  13. {
  14. n1=n/2,n2=n/2+2,n3=(3*n+2)/2,n4=(3*n+2)/2+1;
  15. while (n1>=1&&n3>=n+1)
  16. g<<n3<<' '<<n4<<'\n',--n3,++n4,g<<n1<<' '<<n2<<'\n',--n1,++n2;
  17. g<<n/2+1;
  18. }
  19. else
  20. {
  21. n1=n/2+1,n2=n/2+2,n3=(3*n+2)/2,n4=(3*n+2)/2+2;
  22. while (n1>=1&&n4<=2*n+1)
  23. g<<n1<<' '<<n2<<'\n',--n1,++n2,g<<n3<<' '<<n4<<'\n',--n3,++n4;
  24. g<<1<<' '<<n+1<<'\n';
  25. g<<(3*n+2)/2+1;
  26. }
  27.  
  28. return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement