Cod sursa(job #1647285)
| Utilizator | Data | 10 martie 2016 19:48:11 | |
|---|---|---|---|
| Problema | Subsir crescator maximal | Scor | 10 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.56 kb |
#include <fstream>
#include <algorithm>
using namespace std;
ifstream f ("scmax.in");
ofstream g ("scmax.out");
int main()
{
int x,i,j;
f>>x;
int V[x],M[x];
M[x-1]=1;
for(i=0;i<x;++i)
{
f>>V[i];
}
for(i=(x-1);i>=0;--i)
{
M[i]=1;
for(j=(i+1);j<x;++j)
{
if(V[i]<V[j])
{
M[i]=(M[j]+1);
j=x;
}
}
}
g<<*(max_element(M,M+x));
f.close();
g.close();
return 0;
}
