博彩信誉网站大全|博彩公司|博彩公司排名| welcome!!

当前位置: 主页 > 博彩信誉网站大全 >

博彩公司大全 The Best Polygon (35)(35 分)

时间:2018-12-06 07:56来源:[db:来源] 作者:[db:作者] 点击:
博彩公司大全 The Best Polygon (35)(35 分) An n-gon is a polygon with n sides. For example, a triangle is a 3-gon. Now you are asked to find the best n-gon in a given convex N-gon. The vertices of the n-gon are selected from verti

  博彩公司大全 The Best Polygon (35)(35 分)

  An n-gon is a polygon with n sides. For example, a triangle is a 3-gon. Now you are asked to find the best n-gon in a given convex N-gon. The vertices of the n-gon are selected from vertices of the N-gon. The n-gon you are supposed to find must have the largest area among all possible n-gons, which means that it approximates the N-gon the best. The figure below shows the best 6-gon (the shaded part) in a 10-gon.

  Input Specification:

  Each input file contains one test case. For each case, the first line gives a positive integer N ( 6 <=N <=300 ) which is the total number of vertices of the convex N-gon, and n ( 6 <=n <=min(10, N) ) which is the total number of vertices of the approximating convex n-gon. Then N lines follow, the i-th line gives the 2-D coordinates (x, y) of the i-th vertex ( i=0, … , N-1 ). The x and y coordinates in a line are real numbers with their absolute values no more than 1000, and they are separated by a space.

  Output Specification:

  Print in a line all the vertex indices of the best n-gon in descending order. All the numbers are separated by a space and there must be no extra space at the beginning or the end of the line. It is guaranteed that the solution is unique.

  Sample Input:

  10 6

  133.0 1.0

  544.0 71.0

  558.0 206.0

  536.0 338.0

  463.0 436.0

  330.0 503.0

  188.0 499.0

  305.0 2.0

  55.0 410.0

  2.0 1博彩公司大全.0

  Sample Output:

  9 8 5 3 1 0

  ADS project 4。

  讲理路此雕刻么难的题目给我们当project,教养员不避免也太瞧得宗我们了。

  固然写完事提提交上能AC。

  条是我对我写出产到来的东方正西也不太能清楚的了松,邑是凭觉得写的。。。

  先贴下代码吧。。。

  尽体文思坚硬是DP

  然后是先用graham算法算了壹下穹隆包。然后我发皓像题目后盾给的数据给的不是穹隆包诶。鉴于假设我没拥有拥有那句子graham算法里的n=k,就会拥有测试点TLE和WA,假设是我哪里写错了,请在评论区畅通牒壹下我哈哈!

  graham寻求了穹隆包同时放到arr数组外面面后就末了尾dp

  我是此雕刻么DP的:

  枚举环上的终点,以某个点为终点时

  dp[i][j]体即兴以此点为终点时,前i个点拔取j个点所能到臻的最父亲面积

  f[i][j]体即兴我们算出产dp[i][j]时,最末选用的阿谁点是什么

  譬如从下表为1的点末了尾,dp[5][3]是从1,2,3,4,5五个点中

  拔取3个点结合的面积最父亲,假定是2,4,5叁个点的面积最父亲

  这么f[5][3]就等于5

Copyright @ 2011-2017 Power by DedeCms