题意:linji的仓鼠丢了,他要找回仓鼠,他在房间0放了一块奶酪,按照抓鼠手册所说,这块奶酪可以吸引距离它D的仓鼠,但是仓鼠还是没有出现,现在给出一张关系图,表示各个房间的关系,相邻房间距离为1,而且图中没有回路,每个房间都是联通的,求仓鼠可能出现的房间的数量. 很容易的dfs,50000个房间数据量比较大,用数组难以保存,于是用vector储存关系表.遍历过去,遍历过几个房间,那剩下的就是仓鼠可能出现的房间数了. 代码: /* * Author: illuz <iilluzen[at]gmai…
http://acm.hdu.edu.cn/showproblem.php?pid=4707 Pet Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description One day, Lin Ji wake up in the morning and found that his pethamster escaped. He searched in th…
Pet                                                          Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)                                                                          Total Submission(s): 1909    Acc…
Pet Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2248    Accepted Submission(s): 1098 Problem Description One day, Lin Ji wake up in the morning and found that his pethamster escaped. He sea…
Pet Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 535 Accepted Submission(s): 258 Problem Description One day, Lin Ji wake up in the morning and found that his pethamster escaped. He searched in…
Pet Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 181    Accepted Submission(s): 55 Problem Description One day, Lin Ji wake up in the morning and found that his pethamster escaped. He searche…
Pet Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 1809    Accepted Submission(s): 874 Problem Description One day, Lin Ji wake up in the morning and found that his pethamster escaped. He sear…
Zhuge Liang's Password Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 59    Accepted Submission(s): 47 Problem Description In the ancient three kingdom period, Zhuge Liang was the most famous a…
一道简单的搜索题目,建一个树,根节点是 0 ,连接的两个节点的距离是 1 ,求 到 根节点长度是2的节点的个数. #include<stdio.h> #include<string.h> struct node{ int next,to; int step; }; node edge[]; int tot; ]; int N,D,ans; void Add(int x,int y) { edge[tot].to=y; edge[tot].next=head[x]; head[x]=…
题意:按字母顺序排列成n型,简单的模拟题. 当字母排到z时从a开始重新排起. 代码: /* * Author: illuz <iilluzen[at]gmail.com> * Blog: http://blog.csdn.net/hcbbt * File: a.cpp * Create Date: 2013-09-08 12:31:36 * Descripton: simulate */ #include <cstdio> #define rep(i, n) for (int i…