Объяснение:
#include <iostream>
using namespace std;
int main()
{
int size, positiveCount = 0, negativeCount = 0;
cin >> size;
int* arr = new int[size];
for (int i = 0; i < size; i++)
cin >> arr[i];
if (arr[i] > 0) positiveCount++;
else if (arr[i] < 0) negativeCount++;
}
cout << ((negativeCount == 0) ? 0 : positiveCount / negativeCount) << endl;
Объяснение:
#include <iostream>
using namespace std;
int main()
{
int size, positiveCount = 0, negativeCount = 0;
cin >> size;
int* arr = new int[size];
for (int i = 0; i < size; i++)
{
cin >> arr[i];
if (arr[i] > 0) positiveCount++;
else if (arr[i] < 0) negativeCount++;
}
cout << ((negativeCount == 0) ? 0 : positiveCount / negativeCount) << endl;
}