- 博客(15)
- 收藏
- 关注
转载 异或最大值
COJ 1216: 异或最大值(01字典树)题意:求n个非负数中任意2个的异或值的最大值。n数量级为10^5分析:直接暴力肯定超时了。一个非负整数可以看成1个32位的01字符串,n个数可以看成n个字符串,因此可以建立字典树,建好树后,对于任意非负整数x,可以沿着树根往下贪心找到y,使得x异或y最大,复杂度为树的深度。include #include
2015-06-30 17:31:49 1579
原创 能确定队伍顺序吗
Description某班有N个身高不同的学生,每次上体育课时,体育老师要求他们从高到矮站成一排。现在已知某些学生间的高矮关系,请问你能不能确定他们的顺序?Input多组数据(≤50组)。每组数据第一行两个整数N(2≤N≤50)和M(N-1≤M≤N*(N-1)/2),代表人数和已知的关系个数。接下来M行每行两个整数
2015-06-28 15:41:03 460
转载 Binary Search Tree analog
InputThe first integer of the input is T, the number of test cases.Each test case has two lines.The first line contain an integer N,(1The second line contain N integers sep
2015-06-25 01:07:44 497
原创 Nearest Numbers
Description Given three integer sequences which have been sorted in ascending order,pick one integer from each sequence and we can get three integers.we want these three integers to be nearest
2015-06-23 23:56:33 407
转载 病毒
Description你有一个日志文件,里面记录着各种系统事件的详细信息。自然的,事件的时间戳按照严格递增顺序排列(不会有两个事件在完全相同的时刻发生)。遗憾的是,你的系统被病毒感染了,日志文件中混入了病毒生成的随机伪事件(但真实事件的相对顺序保持不变)。备份的日志文件也被感染了,但由于病毒采用的随机感染方法,主日志文件和备份日志文件在感染后可能会变得不一样。给出被感染的主
2015-06-23 00:27:18 421
原创 Simple Line Editor
DescriptionEarly computer used line editor, which allowed text to be created and changed only within one line at a time. However, in line editor programs, typing, editing, and document displ
2015-06-22 23:07:27 339
转载 集训队分组
Description中南大学ACM的暑期集训马上就要开始了,这次集训会将全体N名集训队员(编号分别为1, 2, …, N)按集训选拔赛的排名分成两组,前K名队员分入A组,其余队员分入B组。但现在助理教练CSGrandeur一不小心把集训选拔赛的排名弄丢了,而之前又没将A组和B组的人员确定出来,于是CSGrandeur打算问一下集训人员他们的名次各是怎样的,以此来确定一下A组的
2015-06-22 00:35:00 409
原创 Nearest Sequence(lcs)
Description Do you remember the "Nearest Numbers"? Now here comes its brother:"Nearest Sequence".Given three sequences of char,tell me the length of the longest common subsequence of
2015-06-19 00:43:08 455
原创 printf(未提交)
#include #include #include #include #include using namespace std; char *p;int input(){ int ret=0,flag=1; while(*p'9') {if(*p=='-')flag=-1; p++;} whil
2015-06-17 00:48:53 357
原创 Water Drinking
DescriptionThe Happy Desert is full of sands. There is only a kind of animal called camel living on the Happy Desert. ‘Cause they live here, they need water here. Fortunately, they find a pond
2015-06-17 00:20:02 437
原创 Number Transformation (bfs) (素数筛选)
Description In this problem, you are given a pair of integers A and B. You can transform any integer number A to B by adding x to A.This x is an integer number which is a prime below A.Now,you
2015-06-15 23:25:52 403
转载 超市购物
Description 上次去超市扫荡回来的东西用完了,Staginner又得跑超市一趟,出发前他列了一张购物清单,打算去买K种不同的商品,每种买一件。到了超市,Staginner发现每种商品有N个品牌,每个品牌此商品的价格为Vi,对Staginner的作用值为Wi,他会从这N个品牌里面挑一个品牌买。这时,Staginner突然想起出门时只带了M元钱,又懒得去取钱了,
2015-06-11 22:06:09 635
转载 删除游戏
DescriptionACM小组喜欢上了一个无聊的游戏,游戏的过程是输入一个正整数n,去掉n的任意S个数字后,把剩下的数字看作是一个新的整数(去除前导零)。对给定的N和S,寻找一种删数规则使得剩下的数字组成的新数(排列顺序不变)最小。希望你也可以加入这个游戏,编写程序来解决这个问题。Input输入包含若干组数据,每组数据一行,为用空格分隔的两个正整数n(2为
2015-06-03 20:36:35 548
原创 xi and bo (并查集问题)
DescriptionBo has been in Changsha for four years. However he spends most of his time staying his small dormitory. One day he decides to get out of the dormitory and see the beautiful city. So
2015-06-03 20:26:24 626
原创 低调低调
DescriptionStaginner总是喜欢把自已的名字写在他出的题目里。CSU-ACM协会的会长想,这孩子是不是想出名想疯了,于是决定考一考他。任意正整数N,不大于N且与N互质的正整数个数记为P,现在给一列与N互质的正整数,只知道一些数各出现P次,而有两个数各只出现了1次,求这两个数。会长对Staginner说,你要是解出了这个题,这道题也加上你的名字
2015-06-01 23:02:27 602
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人