2012年4月12日

poj 2227 dp+树状数组

摘要: 给一个数组,求非递减数列的个数,单个数也算一个dp[a[i]]=sum(dp[a[j]]) j<i && a[j]<a[i],意为最后一个数a[i]的非递减数列若用线性方法,每一个a[i],都要去前边找比a[i]小的数,求和。O(N*N)超时用树状数组求解,注意要离散化 1 #include <iostream> 2 #include <stdio.h> 3 #include <string.h> 4 #include <algorithm> 5 6 using namespace std; 7 typedef lon 阅读全文

posted @ 2012-04-12 09:27 Inpeace7 阅读(248) 评论(0) 推荐(0) 编辑

导航