摘要: 题目链接DescriptionBessie has gone to the mall's jewelry store and spies a charm bracelet. Of course, she'd like to fill it with the best charms possible from theN(1 ≤N≤ 3,402) available charms. Each charmiin the supplied list has a weightWi(1 ≤Wi≤ 400), a 'desirability' factorDi(1 ≤Di≤ 阅读全文
posted @ 2013-04-12 16:54 xindoo 阅读(137) 评论(0) 推荐(0) 编辑
摘要: 题目链接DescriptionA train has a locomotive that pulls the train with its many passenger coaches. If the locomotive breaks down, there is no way to pull the train. Therefore, the office of railroads decided to distribute three mini locomotives to each station. A mini locomotive can pull only a few passe 阅读全文
posted @ 2013-04-12 16:28 xindoo 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 题目链接线段树解法#include #include using namespace std;const int maxn = 100010;struct node{ int l, r, mid, minn;}tree[maxn> 1; tree[o].mid = m; if (l == r) { tree[o].minn = a[l]; return ; } build(l, m, o tree[o].mid) return query(l, r, (o#include using namespace std;co... 阅读全文
posted @ 2013-04-12 13:24 xindoo 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 题目链接A.Yaroslav and Permutations题意: n个元素的数组,每个元素不超过1000,可以交换相邻两个元素,问是否可以在有限次的操作之后使得相邻两个元素的值不相同。#include #include int cnt[1005];int main(){ int n, a; while (scanf("%d", &n) != EOF) { memset(cnt, 0, sizeof(cnt)); for (int i = 0; i m) m = cnt[i]; } if... 阅读全文
posted @ 2013-04-11 07:06 xindoo 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 题目链接MediandynamicMax Score:67The median ofMnumbers is defined as the middle number after sorting them in order ifMis odd or the average number of the middle 2 numbers (again after sorting) ifMis even. You have an empty number list at first. Then you can add or remove some number from the list. For e 阅读全文
posted @ 2013-04-09 20:42 xindoo 阅读(198) 评论(0) 推荐(0) 编辑
摘要: A. Shaass and Oskols题意:在n条电线上有不同数量的鸟, Shaass开了m枪,每一枪打的是第xi条电线上的第yi只鸟,然后被打中的这只鸟左边的飞到第i-1条电线上,右边的飞到i+1条电线上,没有落脚点的鸟会飞走。#include int a[105];int main(){ int n, m, x, y; while (scanf("%d",&n) != EOF) { for (int i = 1; i #include int w[105],t[105],n; int mem[105][205][205]; int m... 阅读全文
posted @ 2013-04-08 07:20 xindoo 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 题目链接DescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic string. That is, for each i (2 1 (if there is one) such that the prefix of S with length i can be written as AK ,th. 阅读全文
posted @ 2013-04-06 14:57 xindoo 阅读(249) 评论(0) 推荐(0) 编辑
摘要: 题目链接DescriptionAstronomers often examine star maps where stars are represented by points on a plane and each star has Cartesian coordinates. Let the level of a star be an amount of the stars that are not higher and not to the right of the given star. Astronomers want to know the distribution of the 阅读全文
posted @ 2013-04-06 10:10 xindoo 阅读(122) 评论(0) 推荐(0) 编辑
摘要: 题目链接DescriptionN (2 #include #include #define maxn 8005using namespace std;int a[maxn];int ans[maxn];int n;int lowbit(int x){ return x&(-x);}void add(int x, int v){ while (x 0) { s += a[x]; x -= lowbit(x); } return s;}int binarysearch(int l, int r, int x){ if (l == r... 阅读全文
posted @ 2013-04-06 09:57 xindoo 阅读(160) 评论(0) 推荐(0) 编辑
摘要: 题目链接 DescriptionAn entropy encoder is a data encoding method that achieves lossless data compression by encoding a message with "wasted" or "extra" information removed. In other words, entropy encoding removes information that was not necessary in the first place to accurately en 阅读全文
posted @ 2013-04-05 15:56 xindoo 阅读(181) 评论(0) 推荐(0) 编辑