| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
How could this be wrong? 555Could someone help me out? Thanks. I am.....
# include <stdio.h>
int num[1001];
int s[1001];
int main ()
{
int n, i, j, value;
freopen("2533.txt", "r", stdin);
scanf ( "%d", &n );
for ( i = 0; i < n; i++ )
{
s[i] = 0;
scanf ( "%d", &num[i] );
}
s[0] = 1;
for ( i = 1; i < n; i++ )
for ( j = 0; j < i; j++)
{
if ( num[j] < num[i] && s[i] < s[j] + 1)
s[i] = s[j] + 1;
}
value = s[0];
for ( i = 1; i < n; i++ )
if ( value < s[i] )
value = s[i];
printf ( "%d", value );
}
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator