2012年5月16日
摘要: 1 /* 2 * 归并排序求逆序对 3 */ 4 5 #include <cstdio> 6 #include <iostream> 7 8 using namespace std; 9 10 const int N = 500005;11 12 long long ans;13 int a[N], b[N];14 15 void mergeSort(int left, int right) {16 int i, j, k, mid;17 if (left < right) {18 mid = (left + right) >> 1;19 ... 阅读全文
posted @ 2012-05-16 20:51 Try86 阅读(153) 评论(0) 推荐(0)
摘要: 1 /* 2 * 0/1背包 3 */ 4 #include <cstdio> 5 #include <cstring> 6 #include <iostream> 7 8 using namespace std; 9 10 const int N = 105;11 const int M = 1005;12 13 int f[M];14 struct pack {15 int cost;16 int value;17 }p[N];18 19 void ZeroOnePack(int n, int cost, int value) {20 for (int 阅读全文
posted @ 2012-05-16 20:43 Try86 阅读(144) 评论(0) 推荐(0)
摘要: 1 /* 2 * 0/1背包 3 */ 4 #include <cstdio> 5 #include <cstring> 6 #include <iostream> 7 8 using namespace std; 9 10 const int M = 30;11 const int N = 30005;12 13 int f[N];14 struct pack {15 int cost;16 int value;17 }p[M];18 19 void ZeroOnePack(int n, int cost, int value) {20 for (int 阅读全文
posted @ 2012-05-16 20:33 Try86 阅读(166) 评论(0) 推荐(0)