Объяснение:
#include <iostream>
using namespace std;
int main()
{
int N, average, sum = 0, counter = 0;
cout << "Введите размер массива (N): ";
cin >> N;
int A[N];
cout << "Вводите значения массива: " << endl;
for (int i = 0; i < N; ++i){
cin >> A[N];
sum += A[N];
}
average = sum / N;
cout << "Среднее арифметическое: " << average << endl;
if(A[i] < average){
counter++;
cout << "Кол-во элементов: " << counter << endl;
return 0;
(см. объяснение)
Решим задачу с Python 3:
k = 0
for x1 in range(2):
for x2 in range(2):
for x3 in range(2):
for x4 in range(2):
for x5 in range(2):
for x6 in range(2):
for x7 in range(2):
for x8 in range(2):
for x9 in range(2):
for x10 in range(2):
if (((x1 == x2) and (x3 == x4)) or (
not (x1 == x2) and not (x3 == x4)) == 0) and (
((x3 == x4) and (x5 == x6)) or (
not (x3 == x4) and not (x5 == x6)) == 0) and (
((x5 == x6) and (x7 == x8)) or (
not (x5 == x6) and not (x7 == x8)) == 0) and (
((x7 == x8) and (x9 == x10)) or (
not (x7 == x8) and not (x9 == x10)) == 0):
k += 1
print(k)
Результат работы программы: 416.
Задание выполнено!
Объяснение:
#include <iostream>
using namespace std;
int main()
{
int N, average, sum = 0, counter = 0;
cout << "Введите размер массива (N): ";
cin >> N;
int A[N];
cout << "Вводите значения массива: " << endl;
for (int i = 0; i < N; ++i){
cin >> A[N];
sum += A[N];
}
average = sum / N;
cout << "Среднее арифметическое: " << average << endl;
for (int i = 0; i < N; ++i){
if(A[i] < average){
counter++;
}
}
cout << "Кол-во элементов: " << counter << endl;
return 0;
}
(см. объяснение)
Объяснение:
Решим задачу с Python 3:
k = 0
for x1 in range(2):
for x2 in range(2):
for x3 in range(2):
for x4 in range(2):
for x5 in range(2):
for x6 in range(2):
for x7 in range(2):
for x8 in range(2):
for x9 in range(2):
for x10 in range(2):
if (((x1 == x2) and (x3 == x4)) or (
not (x1 == x2) and not (x3 == x4)) == 0) and (
((x3 == x4) and (x5 == x6)) or (
not (x3 == x4) and not (x5 == x6)) == 0) and (
((x5 == x6) and (x7 == x8)) or (
not (x5 == x6) and not (x7 == x8)) == 0) and (
((x7 == x8) and (x9 == x10)) or (
not (x7 == x8) and not (x9 == x10)) == 0):
k += 1
print(k)
Результат работы программы: 416.
Задание выполнено!