POJ1944】的更多相关文章

poj1944 一道我不会做的贪心题. (思维才是OI的重点) 但是if您也不会,那就来听我瞎扯吧. 首先,这个图是一个圈,只能连接邻点,使所有求的点联通. 我们先不考虑环,那么就可以想出一个假的做法:用一个a数组记录入度和出度,出度为正,入度为负,用一个sum=0从0遍历每个点记录当前出入度,每次加ai,若sum大于0给答案加上1就行了. 然后,我们来考虑环.我们发现.不管怎么连这个图,肯定都会有一个断边的,连接的路径绝不会是一个完整的环.因为如果连成了完整地环,肯定有一条边断掉这个图还是联通…
Fiber Communications Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 3804   Accepted: 1160 Description Farmer John wants to connect his N (1 <= N <= 1,000) barns (numbered 1..N) with a new fiber-optic network. However, the barns are loc…
Fiber Communications 总时间限制:  1000ms 内存限制:  65536kB 描述 Farmer John wants to connect his N (1 <= N <= 1,000) barns (numbered 1..N) with a new fiber-optic network. However, the barns are located in a circle around the edge of a large pond, so he can on…