- 博客(51)
- 资源 (6)
- 问答 (1)
- 收藏
- 关注
原创 hdu1856 More is better(并查集,运用了压缩路径)
Problem DescriptionMr Wang wants some boys to help him with a project. Because the project is rather complex,the more boys come, the better it will be. Of course there are certain requirements.
2013-07-31 21:06:32 1018
原创 hdu2545 树上战争 (并查集)
Problem Description给一棵树,如果树上的某个节点被某个人占据,则它的所有儿子都被占据,lxh和pfz初始时分别站在两个节点上,谁当前所在的点被另一个人占据,他就输了比赛,问谁能获胜Input输入包含多组数据每组第一行包含两个数N,M(N,M接下来N-1行,每行2个整数A,B(1接下来M行,每行有2个数,表示lxh和pfz的初始位置的编号X,Y(
2013-07-31 17:52:53 1132
原创 hdu2660 Accepted Necklace (DFS)
Problem DescriptionI have N precious stones, and plan to use K of them to make a necklace for my mother, but she won't accept a necklace which is too heavy. Given the value and the weight of each pr
2013-07-31 16:17:30 1195
原创 hdu1175连连看 (超强的 剪枝+DFS)
Problem Description“连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能将
2013-07-30 19:11:00 1223
原创 hdu1258 Sum It Up (DFS)
Problem DescriptionGiven a specified total t and a list of n integers, find all distinct sums using numbers from the list that add up to t. For example, if t=4, n=6, and the list is [4,3,2,2,1,1], t
2013-07-30 15:53:38 961
原创 hdu2952(DFS Counting Sheep )
Problem DescriptionA while ago I had trouble sleeping. I used to lie awake, staring at the ceiling, for hours and hours. Then one day my grandmother suggested I tried counting sheep after I'd gone t
2013-07-30 11:17:24 1067
原创 hdu1312(DFS Red and Black )
Problem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjace
2013-07-30 10:46:50 1622
原创 hdu1518(DFS+剪枝 Square )
Problem DescriptionGiven a set of sticks of various lengths, is it possible to join them end-to-end to form a square?InputThe first line of input contains N, the number of test cases. Each
2013-07-30 10:01:41 1384
原创 hdu1443(约瑟夫环游戏的原理 用链表过的)
Problem DescriptionThe Joseph's problem is notoriously known. For those who are not familiar with the original problem: from among n people, numbered 1, 2, . . ., n, standing in circle every mth is
2013-07-29 19:47:22 1694
原创 hdu3328(翻转card)
Problem DescriptionLittle Bobby Roberts (son of Big Bob, of Problem G) plays this solitaire memory game called Flipper. He starts withn cards, numbered 1 through n, and lays them out in a row with
2013-07-29 13:26:07 1151
原创 hdu1412(水题 用一下链表做){A} + {B}.
Problem Description给你两个集合,要求{A} + {B}.注:同一个集合中不会有两个相同的元素.Input每组输入数据分为三行,第一行有两个数字n,m(0Output针对每组数据输出一行数据,表示合并后的集合,要求从小到大输出,每个元素之间有一个空格隔开.Sample Input1 212 31 211 2
2013-07-29 00:03:45 1428
原创 hdu4414(DFS 找十字架数量)
Problem DescriptionThe Nazca Lines are a series of ancient geoglyphs located in the Nazca Desert in southern Peru. They were designated as a UNESCO World Heritage Site in 1994. The high, arid platea
2013-07-28 23:59:09 1472
原创 hdu1241(DFS Oil Deposits )
Problem DescriptionThe GeoSurvComp geologic survey company is responsible for detecting underground oil deposits. GeoSurvComp works with one large rectangular region of land at a time, and creates a
2013-07-28 23:51:20 984
原创 hdu2553(n皇后)
Problem Description在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output共有若干行,每行一个正整
2013-07-28 09:44:45 911
原创 hdu1572 下沙小面的(2)
Problem Description前文再续,书接上一题。话说当上小面的司机的Lele在施行他的那一套拉客法则以后,由于走的路线太长,油费又贵,不久便亏本了。(真可怜~)于是他又想了一个拉客的办法。对于每一次拉客活动,他一次性把乘客都拉上车(当然也不会超过7个,因为位置只有7个)。然后,Lele计算出一条路线(出于某些目的,Lele只把车上乘客的目的地作为这条路线上的站点),把所有乘
2013-07-27 15:22:51 971
原创 Girls' research 最长回文串
Problem DescriptionOne day, sailormoon girls are so delighted that they intend to research about palindromic strings. Operation contains two steps:First step: girls will write a long string (only
2013-07-27 00:01:48 873
原创 hdu3746(Cyclic Nacklace)
Problem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left. he is too distressed and
2013-07-26 23:58:08 806
原创 hdu1015(Safecracker )
Problem Description=== Op tech briefing, 2002/11/02 06:42 CST === "The item is locked in a Klein safe behind a painting in the second-floor library. Klein safes are extremely rare; most of them, a
2013-07-26 23:49:43 963
原创 hdu1711
Number SequenceTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 8078 Accepted Submission(s): 3670Problem DescriptionGiven two sequences
2013-07-26 13:25:33 1220
原创 亲和串
Problem Description人随着岁数的增长是越大越聪明还是越大越笨,这是一个值得全世界科学家思考的问题,同样的问题Eddy也一直在思考,因为他在很小的时候就知道亲和串如何判断了,但是发现,现在长大了却不知道怎么去判断亲和串了,于是他只好又再一次来请教聪明且乐于助人的你来解决这个问题。亲和串的定义是这样的:给定两个字符串s1和s2,如果能通过s1 # 循环 # 移位
2013-07-26 13:19:49 944
原创 hdu1686
题目意思:找到上串在下串中有多少个Problem DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the b
2013-07-26 13:15:09 1231
原创 Power Strings
Total Submission(s) : 10 Accepted Submission(s) : 4Problem 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"
2013-07-26 13:09:42 1057
原创 hdu1358
Problem 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. Th
2013-07-26 13:04:35 1217
原创 hdu1716(排序2 )
Problem DescriptionRay又对数字的列产生了兴趣:现有四张卡片,用这四张卡片能排列出很多不同的4位数,要求按从小到大的顺序输出这些4位数。Input每组数据占一行,代表四张卡片上的数字(0Output对每组卡片按从小到大的顺序输出所有能由这四张卡片组成的4位数,千位数字相同的在同一行,同一行中每个四位数间用空格分隔。每组输出数据
2013-07-25 11:17:37 1137
原创 hdu1016(素数环)
Problem DescriptionA ring is compose of n circles as shown in diagram. Put natural number 1, 2, ..., n into each circle separately, and the sum of numbers in two adjacent circles should be a prime.
2013-07-25 11:13:32 1069
原创 hdu1010(深搜 +剪枝)
Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He re
2013-07-24 20:09:07 1079
原创 hdu1708(Fibonacci String)
Problem DescriptionAfter little Jim learned Fibonacci Number in the class , he was very interest in it.Now he is thinking about a new thing -- Fibonacci String .He defines : str[n] = str[n-1]
2013-07-22 20:58:12 1789 2
原创 hdu1678(用sort 排序)
Problem DescriptionLindsay is a shopaholic. Whenever there is a discount of the kind where you can buy three items and only pay for two, she goes completely mad and feels a need to buy all items in
2013-07-22 20:08:26 1085
原创 hncu1325
题目描述复习考研累了的时候看看一集二十分钟左右的《生活大爆炸》也不失为一种乐趣。在剧中Sheldon可以说是一个极品,真不知Leonard是如何忍受这位极品室友成天的唠叨。你知道么?Sheldon有一个神秘的小本本,记录了所有他从小开始讨厌的人名。Stuart这位漫画店老板就是小本本的一员哦,谁叫他常常毫不客气地挤兑Sheldon,曾多次赌赢过Sheldon呢。Pe
2013-07-22 16:41:34 2482
原创 hdu1205(类似 分布垃圾数列)
Problem DescriptionA Fibonacci sequence is calculated by adding the previous two members the sequence, with the first two members being both 1.F(1) = 1, F(2) = 1, F(3) = 1,F(4) = 1, F(n>4) = F(n -
2013-07-21 22:12:19 1125
原创 hdu1465(放错信 错排公式)
Problem Description大家常常感慨,要做好一件事情真的不容易,确实,失败比成功容易多了!做好“一件”事情尚且不易,若想永远成功而总从不失败,那更是难上加难了,就像花钱总是比挣钱容易的道理一样。话虽这样说,我还是要告诉大家,要想失败到一定程度也是不容易的。比如,我高中的时候,就有一个神奇的女生,在英语考试的时候,竟然把40个单项选择题全部做错了!大家都学过概率论,应该知道
2013-07-21 12:05:50 1019
原创 hncu1326链表
题目描述链表是数据结构中一种最基本的数据结构,它是用链式存储结构实现的线性表。它较顺序表而言在插入和删除时不必移动其后的元素。现在给你一些整数,然后会频繁地插入和删除其中的某些元素,会在其中某些时候让你查找某个元素或者输出当前链表中所有的元素。下面给你基本的算法描述:图1:链表类型的定义以及获得链表元素的算法描述图2:链表的插入算法描述
2013-07-20 23:38:31 1333
原创 hncu1324 有序线性表合并
题目描述已知线性表 LA 和 LB 中的数据元素按值非递减有序排列,现要求将 LA 和 LB 归并为一个新的线性表 LC, 且 LC 中的数据元素仍然按值非递减有序排列。例如,设LA=(3,5,8,11) ,LB=(2,6,8,9,11,15,20) 则LC=(2,3,6,6,8,8,9,11,11,15,20)算法描述如下:从上述问题要求可知,LC中的数据
2013-07-20 23:35:53 1682
原创 hncu1323线性表
题目描述假设利用两个线性表LA和LB分别表示两个集合A和B(即:线性表中的数据元素即为集合中的成员),现要求一个新的集合A=A∪B。这就要求对线性表做如下操作:扩大线性表LA,将存在于线性表LB中而不存在于线性表LA中的数据元素插入到线性表LA中去。只要从线性表LB中依次取得每个元素,并依值在线性表LA中进行查访,若不存在,则插入之。上述操作过程可用下列算法描述之。
2013-07-20 23:33:04 1442
原创 hdu1408精度问题,好坑人啊
#includeusing namespace std;int main(){ int d,time; double v,V; while(cin>>V>>v) { d=0;time=(int)(V*1.0/v); if(V-time*v>0.000001)//精度 time++; while(V
2013-07-20 17:08:36 1064
原创 hdu1418
#includeusing namespace std;int main(){ unsigned int n,m; while(cin>>n>>m&&(n||m)) cout<<n-1+m-1<<endl;//如果是一个面,则是一个线,则线段数就是点的个数减1 //如果多一个面则说明那些点连起来是多一个环,也就多一条线段数
2013-07-20 16:20:23 884
原创 hdu1420(求余数)
#includeusing namespace std;int main(){ __int64 a,b,c,mod,n; cin>>n; while(n--) { cin>>a>>b>>c; if(c==1) mod=0; else if(b==0&&c>1) mo
2013-07-20 15:53:52 948
原创 hdu1248
#include#includeusing namespace std;int main(){ int t,min,n,i,j,e; scanf("%d",&t); while(t--) { cin>>n; min=n; for(i=0;i<=200/3;i++) for(j=0;j<=50;j
2013-07-19 21:35:24 719
原创 hdu1395
#include#includeint main(){ int n,x,i,t,flog; while(scanf("%d",&n)==1) { if(n%2==0||n==1) printf("2^? mod %d = 1\n",n); else { t=1;flog=1;x=0
2013-07-19 21:32:49 952
原创 hdu1259
#includeusing namespace std;int main(){ int a[8],t,n,p,q,k,i; cin>>t; while(t--) { cin>>n; for(i=1;i<=7;i++) a[i]=i; while(n--) {
2013-07-19 21:28:13 842
TA创建的收藏夹 TA关注的收藏夹
TA关注的人