编程介的小学生 2019-08-15 21:42 采纳率: 20.5%
浏览 127

最大三角形问题,用程序设计

Problem Description
You have a convex polygon. You select three consecutive vertices and create a triangle with them. Remove this triangle from the polygon (if you had a polygon with N vertices, the resulting polygon would have N-1 vertices). Repeat this process until the remaining polygon is a triangle.
You are given the vertices of the polygon in clockwise order. Output the largest possible triangle that can remain at the end.

Input
There are multiple cases (no more than 150).
The first line of each case is an integer n indicating the number of vertices in this polygon (3 <= n && n <= 50).
Then n lines follow, each with two integers x y (0 <= x <= 100, 0 <= y <= 100), giving the cordinate of the vertices.

Output
For each case, output the largest possible triangle that can remain at the end. Keep one digit after the decimal point.

Sample Input
3
1 1
2 3
3 2

4
1 1
1 2
3 3
2 1

Sample Output
1.5
1.5

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 数值计算均差系数编程
    • ¥15 redis-full-check比较 两个集群的数据出错
    • ¥15 Matlab编程问题
    • ¥15 训练的多模态特征融合模型准确度很低怎么办
    • ¥15 kylin启动报错log4j类冲突
    • ¥15 超声波模块测距控制点灯,灯的闪烁很不稳定,经过调试发现测的距离偏大
    • ¥15 import arcpy出现importing _arcgisscripting 找不到相关程序
    • ¥15 onvif+openssl,vs2022编译openssl64
    • ¥15 iOS 自定义输入法-第三方输入法
    • ¥15 很想要一个很好的答案或提示