Cod sursa(job #583903)

Utilizator david95szabo david emanuel david95 Data 23 aprilie 2011 11:58:35
Problema Secv Scor 10
Compilator cpp Status done
Runda Arhiva de probleme Marime 0.52 kb
#include<fstream>
using namespace std;
ifstream fin("secv.in");
ofstream fout("secv.out");
int c[100];
long n;
int main()
{
	int a[100], l[100], j, i, smax = -1; 
	fin >> n;
	for ( i = 1; i <= n; i++ )
		fin >> a[i];
	for ( i = 1; i <= n; i++ )
	{
		l[i] = 1;
		for ( j = 1; j <= i; j++ )
			if ( a[i] > a[j] && l[j] + 1 > l[i] )
			
				l[i] = l[j] + 1;
				
			
	}

			for ( i = 1; i <= n; i++ )
				if ( smax < l[i] ) 
					smax = l[i];
				
		fout << smax;
			
		
				fin.close();
				fout.close();
}