| ||||||||||
| 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:niuzheng168 at 2009-07-21 11:37:14 #include <iostream>
#include <algorithm>
using namespace std;
int main(int argc, char* argv[])
{
int N;
scanf("%d", &N);
int num[1000];
for (int i = 0; i < N; ++i)scanf("%d", &num[i]);
int DP[1000];
fill(&DP[0], &DP[N], 1);
for (int i = 1; i < N; ++i)
for (int j = 0; j < i; ++j)
if (num[j] < num[i]) DP[i] = max(DP[j] + 1, DP[i]);
cout << *max_element(&DP[0], &DP[N])<<endl;
return 0;
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator