Pagini recente » Istoria paginii utilizator/cristinadoroftei | Cod sursa (job #996419) | Cod sursa (job #2098596) | Cod sursa (job #1040483) | Cod sursa (job #1582795)
#include <iostream>
#include <fstream>
using namespace std;
int n, i, v[100000], ok, lmax = -1, pozM, l, poz;
ifstream in("scmax.in");
ofstream out("scmax.out");
int main()
{
int j;
in>>n;
for(i=0;i<n;i++){
in>>v[i];
}
for(i=0;i<n;i++){
j = i + 1;
l=0;ok = 0;
while(ok == 0 && j < n){
if(v[j] >= v[j+1]){
l++;
}else{
ok = 1;
}
if(lmax == -1 || pozM == i){
lmax++;
pozM = i;
}else{
if(l> lmax){
pozM = i;
lmax = l;
}
}
j++;
}
}
for(i=pozM;i<n;i++){
if(v[i] != v[i+1])
out<<v[i]<<" ";
}
}