摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1257找数列中递减数列的个数....View Code 1 #include <iostream> 2 #include <cstdio> 3 using namespace std; 4 const int maxn=1000005; 5 int ans[maxn],num; 6 bool f[maxn]; 7 int main() 8 { 9 int n,i,t,j;10 while(~scanf("%d",&n)){11 for(i=0;i<n; 阅读全文
posted @ 2012-09-06 21:19 YORU 阅读(161) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2689这题冒泡能过,反正我是归并的....题目就是求逆序对..View Code 1 #include <iostream> 2 using namespace std; 3 const int maxn=101; 4 int ans[maxn][maxn],v[maxn],w[maxn]; 5 int main() 6 { 7 int n,m,k,s,i,j,l,max; 8 while(cin>>n>>m>>k>>s) 9 {10 max=-1; 阅读全文
posted @ 2012-09-06 20:39 YORU 阅读(168) 评论(0) 推荐(0)
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2159二维的背包问题....个人感觉是0/1背包和完全背包的结合.View Code 1 #include <iostream> 2 using namespace std; 3 const int maxn=101; 4 int ans[maxn][maxn],v[maxn],w[maxn]; 5 int main() 6 { 7 int n,m,k,s,i,j,l,max; 8 while(cin>>n>>m>>k>>s) 9 {10 max=- 阅读全文
posted @ 2012-09-06 19:58 YORU 阅读(171) 评论(0) 推荐(0)