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 |
为什么我的也是WA么??#include <iostream> //#include <fstream> using namespace std; //ifstream fin("a.txt"); int solve(int ); int main() { int n; cin>>n; cout<<solve(n)<<endl; return 1; } int solve(int n) { int i,j,max; int num[1010]; int ans[1010]; for(i=0;i<n;i++){ cin>>num[i]; ans[i]=1; } for(i=n-2;i>=0;i--){ max=1; for(j=i+1;j<=n-1;j++) if(num[i]<num[j]&&max<ans[j]+1) max=ans[j]+1; ans[i]=max; } return ans[0]; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator