随笔分类 -  dp

摘要:#include #include #include #include using namespace std;typedef struct Channel{ int s,t;}channel;int cmp(const void *a, const void *b){ channel *c = (channel *) a; channel *d = (channel *) b; if(c->t != d->t) return c->t - d->t; else return c->s - d->s;}//qsort/*int cmp(const chann 阅读全文
posted @ 2013-10-20 15:57 i梦 阅读(173) 评论(0) 推荐(0)
摘要:#include #include #include using namespace std;int F[210000];int V;void ZeroOnePack(int cost, int weight){ for(int i = V; i >= cost; i --) if(F[i-cost] + weight > F[i]) F[i] = F[i-cost] + weight;}void CompletePack(int cost, int weight){ for(int i = cost; i F[i]) F... 阅读全文
posted @ 2013-10-18 17:47 i梦 阅读(180) 评论(0) 推荐(0)
摘要:#include #include using namespace std;int a[5850];int Min(int a, int b, int c, int d){ int x = a > n){ if(n == 0) break; cout << "The " << n ; if(n % 10 == 1 && n % 100 != 11) cout << "st " ; else if(n % 10 == 2 && n % 100 != 12) cout << 阅读全文
posted @ 2013-10-15 14:31 i梦 阅读(136) 评论(0) 推荐(0)