x*8
2 楼
我家女儿7个多月了,由于最近冬天,天冷,有时候把尿她不尿,不把的时候马上把裤
子尿湿了。那天妈妈跟我说起这事,说妞妞这几天总是把裤子尿湿,怎么怎么的,结果
她就把头歪到我妈的胳膊上一趴,哭起来了。然后我妈就赶紧说,好了好了,不说你了
,然后人家就自己用袖子抹了一下眼睛,就不哭了。7个多月,懂什么啊,呵呵。
子尿湿了。那天妈妈跟我说起这事,说妞妞这几天总是把裤子尿湿,怎么怎么的,结果
她就把头歪到我妈的胳膊上一趴,哭起来了。然后我妈就赶紧说,好了好了,不说你了
,然后人家就自己用袖子抹了一下眼睛,就不哭了。7个多月,懂什么啊,呵呵。
i*r
3 楼
看不到题目,谁贴个题目来看看吧
b*8
4 楼
真是 太可爱了!
B*5
5 楼
这么快。。。
我一个好友进前100了。。。
我一个好友进前100了。。。
h*u
8 楼
懂的比你想像的多,不过不会表达就是了
w*t
14 楼
很正常,我儿子小时候只要我和他爹说他什么,或者学他的声音,他立刻就哭
p*2
16 楼
In a certain business sector there are currently N small companies, each
having just a single employee. These employees are numbered 1 through N.
The business sector is about to be transformed into a monopoly. This will
happen through a series of mergers, until there is only one company. A
single merger involves two companies. In a merger, the president of one
company becomes the direct report of the president of the other company,
preserving the rest of the hierarchies of both companies.
You will be given the descriptions of all mergers. Depending on how they are
performed (which of the two presidents involved becomes the president of
the new company), the hierarchy can of the final company can take different
shapes. We want the hierarchy of the final company to be as shallow as
possible. The task is to find the smallest possible number of levels in the
final hierarchy.
There is also a limit D on the number of direct reports any employee can
have. Because of this limit, there may be only one way to accomplish a
certain merger, or it might even be impossible. However, there will always
be some way to accomplish all the mergers.
Input
The first line contains the number of test cases T.
Each test case starts with a blank line. The next line contains two integers
, N and D.
Each of the following N-1 lines describes a single merger, with two integers
between 1 and N. These are the employees whose companies are merging. The
two employees will never already be part of the same company.
The mergers must be performed in the order in which they are given.
Constraints
5 ≤ T ≤ 20
2 ≤ N ≤ 30000
1 ≤ D ≤ 5000
The input test cases will be such that it is possible to accomplish all
mergers.
Output
For each of the test cases numbered in order from 1 to T, output "Case #i: "
followed by a single integer, the smallest number of levels in the final
hierarchy.
Examples
In the first example, we have N=3 and D=2. The first merger happens between
the companies of employees 1 and 2. In the resulting company we can have
employee 1 as the president with 2 as his report, or vice versa. Next this
company merges with the company of employee 3. If we have employee 3 become
the president, the hierarchy will be a chain 3-1-2 or 3-2-1. If 1 or 2
become the president, that president will have the other two employees as
direct reports. This last hierarchy has two levels.
Example inputExample output
5
3 2
1 2
1 3
3 1
1 2
1 3
4 2
4 2
2 1
3 2
5 2
5 2
4 5
2 1
3 1
6 3
6 1
4 2
1 4
5 6
3 6
Case #1: 2
Case #2: 3
Case #3: 3
Case #4: 3
Case #5: 4
【在 l*****a 的大作中提到】
: share 一下题目,大家讨论一下吧
p*2
17 楼
我觉得上边这道还算是有思路的。不过我们几个人都做错了。
i*r
18 楼
并查集
相关阅读
刚才看到一篇文章讲家长的参与在大多数情况下对孩子学业帮助不大有什么好纠结的?就把中文当成母语加第二语言学不就完了?请推荐袖珍电子词典美国考大学都是哪些专业招分高, 比较热门?今天完成第二所 Language Academy 的围棋普及小O杂谈:没什么舍得不舍得的有没有想帮孩子买钢琴的父母想要一起团购钢琴的呀?4岁娃字母都学会之后应该学啥?老师说娃有点落后了请问给朋友的小孩送礼物 (转载)流鼻血需要看医生么美国学生的课程不简单啊!求教推荐,北新泽西,纽约附近4岁女孩儿上的兴趣班第二外语选西语、法语、德语?请推荐个学钢琴启蒙的电子琴寻找南湾有PT/OT背景的朋友 (转载)求推荐OB(GYN)医生,我们在ROCKVILLE, MARYLAND应该怎么跟幼儿园说孩子不开心呢?2岁多的宝宝 晚上睡觉哭醒2,3岁 求建议有机鸡蛋大家都买哪个牌子的?其实我一直有个问题,大家说的中国文化独有的价值观到底是什么