Untitled

mail@pastecode.io avatar
unknown
c_cpp
7 months ago
382 B
0
Indexable
Never
#include <iostream>
using namespace std;
int main() {
    int n;
    int a;
    int maxa = -2147483647;
    int count = 0;

    cin >> n;

    for (int i = 0; i < n; ++i) {
        cin >> a;

        if (a > maxa) {
            maxa = a;
            count = 1;
        }
        else if (a == maxa) {
            count++;
        }
    }

    cout << count;
}
Leave a Comment