
Poj
lkbsbird
这个作者很懒,什么都没留下…
展开
-
Poj 2752
DescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babies. They seek the name, and at the sa原创 2016-07-08 20:36:05 · 262 阅读 · 0 评论 -
Poj 2406(同1961)
DescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as multiplication, exponenti原创 2016-07-08 18:13:16 · 224 阅读 · 0 评论 -
Poj 1840
DescriptionConsider equations having the following form: a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0 The coefficients are given integers from the interval [-50,50]. It is consider a solution a syste原创 2016-07-19 09:01:33 · 303 阅读 · 0 评论 -
Poj 2001 Shortest Prefixes
DescriptionA prefix of a string is a substring starting at the beginning of the given string. The prefixes of "carbon" are: "c", "ca", "car", "carb", "carbo", and "carbon". Note that the empty str原创 2016-07-07 14:54:55 · 214 阅读 · 0 评论 -
Poj:3974 回文串
DescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algorithm to find the le原创 2016-07-07 14:20:22 · 218 阅读 · 0 评论 -
Poj:3630
DescriptionGiven a list of phone numbers, determine if it is consistent in the sense that no number is the prefix of another. Let's say the phone catalogue listed these numbers:Emergency 911原创 2016-07-07 12:44:28 · 213 阅读 · 0 评论 -
Poj 2777
题意:L,T,OL代表长度,T代表颜色的数量,O代表操作的数量,C A B C 从A到B全染成CP A B 查询 A到B颜色的种类#include#include#includeusing namespace std;const int N=100010;#define L(rt) (rt<<1)#define R(rt) (rt<<1|1)struct Tr转载 2016-07-06 14:06:44 · 307 阅读 · 1 评论 -
Poj:2503 Babelfish
DescriptionYou have just moved from Waterloo to a big city. The people here speak an incomprehensible dialect of a foreign language. Fortunately, you have a dictionary to help you understand them.原创 2016-07-06 20:54:56 · 223 阅读 · 0 评论 -
Poj 2002
题意:给一个数N,下面给N行,每行给一个X,Y,表示坐标,求这些坐标能组成正方形最大个数解析:先枚举两个点,通过数学公式得到另外2个点,使得这四个点能够成正方形。然后检查散点集中是否存在计算出来的那两个点,若存在,说明有一个正方形。但这种做法会使同一个正方形按照不同的顺序被枚举了四次,因此最后的结果要除以4.数学公式:(x1,y1) (x2,y2)则: x3=x1+(y1原创 2016-07-16 14:09:21 · 317 阅读 · 0 评论 -
Poj 1456 Supermarket(2)
题意:有N件商品,知道了商品的价值和销售的最后期限,只要在最后日期之前销售处,就能得到相应的利润,并且销售该商品需要1天时间,求出最大利润。 解析:先进行利润从大到小的排序,然后利用vis数组进行标记来记录当前的时间是否满足,主要利用的是贪心算法#include<cstdio>#include<cstring>#include<algorithm>using namespace std;c原创 2016-07-01 17:16:41 · 270 阅读 · 0 评论 -
Poj 1456 Supermarket
题意:有N件商品,知道了商品的价值和销售的最后期限,只要在最后日期之前销售处,就能得到相应的利润,并且销售该商品需要1天时间,求出最大利润。 解析:先进行利润从高到低的排序,利用并查集按利润排序,建立一个关于时间的并查集:每次插入一个物品时,若该物品时间为 i,找出find(i),记为t,若t不为0,则将该物品安排到t这个时间完成,并使f[t]=t-1 亦即对于每个物品尽量#include<cst原创 2016-07-01 17:09:31 · 279 阅读 · 0 评论 -
Poj 2309 BST
题意:So easy的树状数组 解析:使用lowbit即可#include<cstdio>#include<cstring>#include<string>#include<algorithm>using namespace std;int n;long long lowbit(long long a){ return a&(-a);}int main(){ s原创 2016-07-01 17:04:34 · 265 阅读 · 0 评论 -
Poj 1988 Cube Stacking
题意:eee 解析:fsss#include<cstdio>#include<cstring>#include<string>#include<algorithm>using namespace std;const int maxn=100009;int set[maxn];int top[maxn];int cnt[maxn];int n;int find(int x){原创 2016-06-30 10:18:47 · 223 阅读 · 0 评论 -
Poj 2524 Ubiquitous Religions
题意:简单并查集 解析:统计不同信仰的学生,标记即可#include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn=50009;int student[maxn];int n,m;int find(int x){ if(student[x]!=x) retu原创 2016-06-30 10:45:24 · 237 阅读 · 0 评论 -
Poj 3450
DescriptionBeside other services, ACM helps companies to clearly state their “corporate identity”, which includes company logo but also other signs, like trademarks. One of such companies is Inter原创 2016-07-09 12:15:07 · 271 阅读 · 0 评论