Pagini recente » Cod sursa (job #519601) | Istoria paginii runda/28_februarie_simulare_oji_2024_clasa_9/clasament | Cod sursa (job #1035287) | Cod sursa (job #1222246) | Cod sursa (job #2232876)
#include <fstream>
const std::string programName = "elmaj";
std::ifstream f(programName + ".in");
std::ofstream g(programName + ".out");
const int MAX = 5e5;
int main() {
int N;
f >> N;
int ap[MAX + 5] = {0};
while (N--) {
int nr;
f >> nr;
ap[nr]++;
}
int max = 0, Xcopy;
for (int i = 0; i < MAX; ++i)
if (ap[i] > 0)
if (ap[i] > max) {
max = ap[i];
Xcopy = i;
}
g << Xcopy << ' ' << max;
return 0x0;
}