/******************************************************************************
Welcome to GDB Online.
GDB online is an online compiler and debugger tool for C, C++, Python, Java, PHP, Ruby, Perl,
C#, VB, Swift, Pascal, Fortran, Haskell, Objective-C, Assembly, HTML, CSS, JS, SQLite, Prolog.
Code, Compile, Run and Debug online from anywhere in world.
*******************************************************************************/
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
int N;
cout << "Введите N: ";
cin >> N;
int arr[N];
srand(time(NULL));
for(int i = 0; i < N; i++)
{
arr[i] = rand()%101 - 50;
cout << arr[i] << ' ';
}
int Z;
cout << "\nВведите Z: ";
cin >> Z;
for(int i = 0; i < N; i++)
{
arr[i] = (arr[i] < Z) ? arr[i] : Z;
cout << arr[i] << ' ';
}
int sum_odd = 0;
int sum_even = 0; // четный
for(int i = 0; i < N; i++)
{
if (arr[i] & 1)
sum_odd++;
else
sum_even++;
}
cout << "\nЧетных элементов: " << sum_even << '\n';
cout << "Нечетных элементов: " << sum_odd << '\n';
return 0;
}