// os-demo-20160930-2.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include #include #include #include const int n = 100000; int mas[n]; //int *mas; int _tmain(int argc, _TCHAR* argv[]) { //mas = (int*)calloc(100001, sizeof(int)); for (int i = 0; i < n / 2; i++) { mas[i] = i; } std::sort(mas, mas + n / 2); for (int i = n / 2 + 1; i < n; i++) { if (mas[i] % 2 == 0) mas[i] =- mas[i]; } for (size_t i = 0; i < 10; i++) { std::cout << mas[i] << std::endl; } return 0; }