Advertisement
andruhovski

Untitled

Sep 30th, 2016
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. // os-demo-20160930-2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. #include <stdlib.h>
  7. #include <algorithm>
  8. #include <procces.h>
  9. const int n = 100000;
  10. int mas[n];
  11. //int *mas;
  12. int _tmain(int argc, _TCHAR* argv[])
  13. {
  14. //mas = (int*)calloc(100001, sizeof(int));
  15. for (int i = 0; i < n / 2; i++)
  16. {
  17. mas[i] = i;
  18. }
  19.  
  20. std::sort(mas, mas + n / 2);
  21.  
  22. for (int i = n / 2 + 1; i < n; i++)
  23. {
  24. if (mas[i] % 2 == 0)
  25. mas[i] =- mas[i];
  26. }
  27.  
  28.  
  29.  
  30. for (size_t i = 0; i < 10; i++)
  31. {
  32. std::cout << mas[i] << std::endl;
  33. }
  34.  
  35. return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement