Pagini recente » Cod sursa (job #2646989) | Cod sursa (job #3203609) | Cod sursa (job #1702579) | Cod sursa (job #302057) | Cod sursa (job #731097)
Cod sursa(job #731097)
#include <fstream>
using namespace std;
ifstream fin("scmax.in");
ofstream fout("scmax.out");
int main()
{
int lg = 0, lgmax = 0, l = 0, dr, drmax, a[100000];
int n;
fin >> n;
for(int i = 1; i <= n; i++)
fin >> a[i];
for(int i = 1; i <= n; i++)
if(a[i + 1] > a[i])
{
lg++;
dr = i + 1;
}
else
{
if(lg > lgmax)
{
lgmax = lg;
drmax = dr;
}
lg = 0;
}
fout << lgmax + 1 << '\n';
for(int i = drmax - lgmax ; i <= drmax; i++)
fout << a[i] << " ";
fin.close();
fout.close();
return 0;
}