From c40cb9383119e1754604993d7d78e2cb8f7d7e60 Mon Sep 17 00:00:00 2001 From: Kirito <1362050620@qq.com> Date: Wed, 27 Apr 2016 10:33:29 +0800 Subject: [PATCH] From http://www.cnblogs.com/d-e-v-i-l/p/5436755.html --- SDUSTOJ/1800_cnblogs.cpp | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 SDUSTOJ/1800_cnblogs.cpp diff --git a/SDUSTOJ/1800_cnblogs.cpp b/SDUSTOJ/1800_cnblogs.cpp new file mode 100644 index 0000000..ee07cf3 --- /dev/null +++ b/SDUSTOJ/1800_cnblogs.cpp @@ -0,0 +1,50 @@ +/* *********************************************** +Author :devil +Created Time :2016/4/26 21:58:52 +************************************************ */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +using namespace std; +const int N=1010; +int dp[N],a[N],b[N],c[N]; +int main() +{ + //freopen("in.txt","r",stdin); + int t,n; + scanf("%d",&t); + while(t--) + { + scanf("%d",&n); + for(int i=1; i<=n; i++) + scanf("%d",&a[i]); + int ma=0; + memset(c,0,sizeof(c)); + c[1]=n; + for(int i=1; i<=n; i++) + { + b[i]=dp[i]=1; + for(int j=1; ja[j]&&dp[i]a[j]&&dp[i]==dp[j]+1) b[i]+=b[j]; + } + if(dp[i]>1) c[dp[i]]+=b[i]; + ma=max(ma,dp[i]); + } + printf("%d\n",c[ma]); + } + return 0; +}