Pagini recente » Profil Stefan_Radu | Cod sursa (job #3203940) | Monitorul de evaluare | Monitorul de evaluare | Cod sursa (job #579214)
Cod sursa(job #579214)
#include <fstream>
#include <cstring>
using namespace std;
ifstream fin("scmax.in");
ofstream fout("scmax.out");
#define DIM 10001
int L[DIM], R[DIM];
int a[10001];
int n;
int main()
{
int smax = -1, i, j;
fin >> n;
for ( i = 0; i < n; ++ i )
fin >> a[i];
for ( i = 0; i < n; ++i )
{
L[i] = 1;
for ( j = 0; j < i; ++j )
if ( L[j] + 1 > L[i] && a[i] > a[j] )
L[i] = L[j] + 1;
}
if ( smax < L[i] )
smax = L[i] ;
fout << smax;
fin.close();
fout.close();
return 0;
}