Cod sursa(job #272793)
| Utilizator | Data | 7 martie 2009 20:02:12 | |
|---|---|---|---|
| Problema | Subsir crescator maximal | Scor | 35 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.5 kb |
#include <stdio.h>
int v[100002];
int lung[100002];
int main()
{
int max;
freopen("scmax.in","r",stdin);
freopen("scmax.out","w",stdout);
scanf("%d",&v[0]);
for(int i=1;i<=v[0];i++)
scanf("%d",&v[i]);
for(int i=1;i<=v[0];i++)
{ max=lung[i];
for(int j=1;j<i;j++)
if(v[i]>v[j])
if(max<lung[j]) max=lung[j];
lung[i]=max+1;
}
max=1;
for(int i=1;i<=v[0];i++)
if(max<lung[i]) max=lung[i];
printf("%d\n",max);
fclose(stdin);
fclose(stdout);
return 0;
}
