Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
293 B
0
Indexable
Never
#include <iostream>

int main()
{
	int n = 0;
	int tmp = 0;
	int max = 0;
	int count = 0;

	std::cin >> n;
	
	for (int i = 0; i < n; i++) {
		std::cin >> tmp;
		if (tmp > max) {
			max = tmp;
			count = 0;
		}
		if (tmp == max) {
			count++;
		}
	}
	std::cout << count;
}
Leave a Comment