// 1
#include <iostream>
int main() {
int n;
std::cin >> n;
int *arr = new int[n];
for (int i = 0; i < n; ++i)
std::cin >> arr[i];
int count = 0;
if (arr[i] > 0)
count++;
std::cout << count;
}
// 2
double *arr = new double[n];
double k;
std::cin >> k;
if (arr[i] == k)
// 3
long long multi = 1;
if (arr[i] % 2 != 0)
multi *= arr[i];
std::cout << multi;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
// 1
#include <iostream>
int main() {
int n;
std::cin >> n;
int *arr = new int[n];
for (int i = 0; i < n; ++i)
std::cin >> arr[i];
int count = 0;
for (int i = 0; i < n; ++i)
if (arr[i] > 0)
count++;
std::cout << count;
}
// 2
#include <iostream>
int main() {
int n;
std::cin >> n;
double *arr = new double[n];
for (int i = 0; i < n; ++i)
std::cin >> arr[i];
double k;
std::cin >> k;
int count = 0;
for (int i = 0; i < n; ++i)
if (arr[i] == k)
count++;
std::cout << count;
}
// 3
#include <iostream>
int main() {
int n;
std::cin >> n;
int *arr = new int[n];
for (int i = 0; i < n; ++i)
std::cin >> arr[i];
long long multi = 1;
for (int i = 0; i < n; ++i)
if (arr[i] % 2 != 0)
multi *= arr[i];
std::cout << multi;
}