shunfurh 于 2017.01.11 22:32 提问
 Porcelain Exhibitions

问题描述 :
Recently, the Chinese government is going to hold a porcelain exhibition in every province.
For fascinating citizens, each exhibition should put at least MIN_K porcelains on show. And by the restriction of conditions, at most MAX_K porcelains can be shown in an exhibition.The number of porcelains in a province is in direct proportion to the area of that province. So some small provinces may don’t have enough porcelains, and some big provinces may have more porcelains than it can show(having too much porcelains is not a problem for holding an exhibition, just don’t show some of them). The government decides to transport some porcelains between provinces so that every province can hold an exhibition.
Because of the limitation of traffic, the amount of porcelains passing a boundary between two provinces is limited. So the government asks you to write a program to manage the transportation.
The map of China can be seen as a connected planar graph embedded on a plane. Each face of the graph represents a province. This graph has N vertices and M edges. A vertex of the graph is also a point on the map, and an edge is also a line segment connecting two points, meaning a boundary between two provinces.
输入:
The input will consist of multiply test cases. For each case, The first line contains five positive integers — above mentioned N, M, MIN_K,MAX_K and P( N <= 1000,M <= 10000, MIN_K < MAX_K) . P means that if the area of a province is A, then there are A×P porcelains in that province. P is guaranteed to be even so that the amount of porcelains in each province will be a positive integer.
The next N lines, each gives two integer x, y, representing the coordinate of a vertex(Vertexes have distinct coordinates). The vertexes are numbered from 0 to N1 and the coordinates are given in the order of vertex No.
The next M lines, each gives three integers u,v, and w. It means that there is an edge connecting vertex u and vertex v. The edge is also a boundary between two provinces. w means that the boundary can’t let more than w porcelains to pass through. (w for the boundary of China is 0, and boundaries don’t overlap). The number of province is less than 2000.
Unsigned int is enough for this problem. The input ends with 0 0 0 0 0.输出:
The input will consist of multiply test cases. For each case, The first line contains five positive integers — above mentioned N, M, MIN_K,MAX_K and P( N <= 1000,M <= 10000, MIN_K < MAX_K) . P means that if the area of a province is A, then there are A×P porcelains in that province. P is guaranteed to be even so that the amount of porcelains in each province will be a positive integer.
The next N lines, each gives two integer x, y, representing the coordinate of a vertex(Vertexes have distinct coordinates). The vertexes are numbered from 0 to N1 and the coordinates are given in the order of vertex No.
The next M lines, each gives three integers u,v, and w. It means that there is an edge connecting vertex u and vertex v. The edge is also a boundary between two provinces. w means that the boundary can’t let more than w porcelains to pass through. (w for the boundary of China is 0, and boundaries don’t overlap). The number of province is less than 2000.
Unsigned int is enough for this problem. The input ends with 0 0 0 0 0.样例输入:
8 9 5 8 2
0 0
0 3
3 3
3 0
1 1
1 2
2 2
2 1
0 1 0
1 2 0
2 3 0
3 0 0
4 5 1
5 6 1
6 7 1
7 4 1
0 4 1
8 9 7 8 2
0 0
0 3
3 3
3 0
1 1
1 2
2 2
2 1
0 1 0
1 2 0
2 3 0
3 0 0
4 5 1
5 6 1
6 7 1
7 4 1
0 4 1
0 0 0 0 0
样例输出:14
1
导师推荐申请成为导师
 caozhy 推荐了： C语言二维数组输出矩阵
 dcxy0 推荐了： springboot启动访问页面报错