| ||||||||||
| 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 | |||||||||
Re求教:为什么会超时In Reply To:为什么超时 Posted by:974529 at 2011-08-22 11:05:24 > #include "stdio.h"
> int main()
> {
> int d[100000], lengh;
> int a[100000], max;
> int i, j;
>
> while (scanf("%d",&lengh))
> {
>
> max = 1;
> for (i = 1; i <= lengh; i++)
> {
> scanf("%d",&a[i]);
> }
>
> d[1] = 1;
> for(i = 2;i<= lengh;i++)
> {
> d[i] = 1;
> for(j = 1;j < i;j++)
> {
> if(a[i] > a[j] && d[i] < d[j]+1)
> d[i] = d[j]+1;
>
> }
> if(d[i] > max) max = d[i];
> }
>
> printf("%d\n",max);
> }
>
> return 0;
> }
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator