标签:style blog os io for 2014 amp log
思路和2391一样的。。
<span style="font-size:24px;">#include<stdio.h> #include<string.h> #include<iostream> #include<algorithm> using namespace std; const int inf=(0x7f7f7f7f); int main() { int a; int s[10005]; int w[10005]; while(scanf("%d",&a)&&a) { for(int i=1;i<=a;i++) scanf("%d",&s[i]); memset(w,0,sizeof(w)); for(int i=0;i<=a-1;i++) for(int j=i+1;j<=a;j++) { if(s[i]<s[j]) { if(w[j]<s[j]+w[i]) w[j]=s[j]+w[i]; } } int ans=-22; for(int i=0;i<=a;i++) if(w[i]>ans) ans=w[i]; printf("%d\n",ans); } return 0; }</span>
标签:style blog os io for 2014 amp log
原文地址:http://blog.csdn.net/asuxiexie/article/details/38564527