[ZOJ2669]Lattice Animals Time Limit: 5 Seconds Memory Limit: 32768 KB Lattice animal is a set of connected sites on a lattice. Lattice animals on a square lattice are especially popular subject of study and are also known as polyminoes. Polymino…
How far away [题目链接]How far away [题目类型]dfs+邻接表 &题意: 题目大意:一个村子里有n个房子,这n个房子用n-1条路连接起来,接下了有m次询问,每次询问两个房子a,b之间的距离是多少. &题解: 我以为是LCA的题,但dfs居然也能过,感觉是数据有点弱,(时间复杂度是4000x200x10,想了想10组又不能全是200,所以应该勉强可以)但学到了邻接表的数组形式,用数组表示链表,很厉害的样子,感觉和前向星好相似啊 &代码: #include…
统计问题 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 6506 Accepted Submission(s): 3836 Problem Description 在一无限大的二维平面中,我们做例如以下如果: 1. 每次仅仅能移动一格: 2. 不能向后走(如果你的目的地是"向上",那么你能够向左走,能够向右走,也能…
Fibonacci again and again Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6363 Accepted Submission(s): 2646 Problem Description 任何一个大学生对菲波那契数列(Fibonacci numbers)应该都不会陌生,它是这样定义的:F(1)=1;F(2)=2;…