Untitled

 avatar
unknown
c_cpp
2 years ago
293 B
3
Indexable
#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;
}
Editor is loading...
Leave a Comment