Răspuns:
#include <iostream>
using namespace std;
int main()
{
int n, maxim, nr=0;
cin >> n;
int x[n], i;
for (i=0; i<n; i++)
cin >> x[i];
maxim = x[0]; nr=1;
for (i=1; i<n; i++)
if (x[i]>maxim) {
maxim = x[i]; nr = 1;
}
else {
if (x[i]== maxim) ++nr;
}
cout << maxim << endl;
cout << nr << endl;
for (i=0; i<n; i++) {
if (x[i] == maxim) {
cout << i+1 << " ";
}
}
return 0;
}
Explicație: