摘要: The traffic network in a country consists of N cities (labeled with integers from 1 to N) and N-1 roads connectingthe cities. There is a unique path between each pair of different cities, and we know the exact length of each road.Write a program that will, for each of the K given pairs of cities, fi 阅读全文
posted @ 2013-09-20 23:24 Oyking 阅读(457) 评论(0) 推荐(0) 编辑
摘要: Description在一些一对一游戏的比赛(如下棋、乒乓球和羽毛球的单打)中,我们经常会遇到A胜过B,B胜过C而C又胜过A的有趣情况,不妨形象的称之为剪刀石头布情况。有的时候,无聊的人们会津津乐道于统计有多少这样的剪刀石头布情况发生,即有多少对无序三元组(A, B, C),满足其中的一个人在比赛中... 阅读全文
posted @ 2013-09-20 15:27 Oyking 阅读(444) 评论(0) 推荐(0) 编辑
摘要: DescriptionWhen FJ's friends visit him on the farm, he likes to show them around. His farm comprises N (1 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 8 const int MAXV = 1010; 9 const int MAXE = 40010;10 const int INF = 0x7f7f7f7f;11 12 struct SPFA_COST_FLOW {13 boo... 阅读全文
posted @ 2013-09-20 11:13 Oyking 阅读(351) 评论(0) 推荐(0) 编辑
摘要: DescriptionDearboy, a goods victualer, now comes to a big problem, and he needs your help. In his sale area there are N shopkeepers (marked from 1 to N) which stocks goods from him.Dearboy has M supply places (marked from 1 to M), each provides K different kinds of goods (marked from 1 to K). Once s 阅读全文
posted @ 2013-09-20 00:49 Oyking 阅读(235) 评论(0) 推荐(0) 编辑