Pagini recente » Cod sursa (job #2133476) | Muzica | Cod sursa (job #1770879) | Cod sursa (job #2722743) | Cod sursa (job #1477531)
// Galatan Tudor - Liceul Teoretic "Ion Luca"
// Vatra Dornei, 26.08.2015
#include <fstream>
#define R 1000001
using namespace std;
ifstream f("elmaj.in");
ofstream g("elmaj.out");
int nr_ap[R];
int n, i, x, el_maj;
int main ()
{
f >> n;
for (i=0; i<n; i++)
{
f >> x;
nr_ap[x]++;
if (nr_ap[x] > nr_ap[el_maj])
el_maj = x;
}
if (nr_ap[el_maj] >= n/2+1)
g << el_maj << nr_ap[el_maj];
else
g << "-1";
return 0;
}