编程介的小学生 2019-03-19 22:59 采纳率: 20.5%
浏览 175

C语言线圈的连接的可能性的判断的问题,运用算法的实现的思路具体怎么做

Problem Description
George has K <= 20 steel wires shaped in the form of half-circles, with radii a1, a2, . . . , aK. They can be soldered (connected) at the ends, in any angle. Is it possible for George to make a closed shape out of these wires? He does not have to use all the wires.
The wires can be combined at any angle, but may not intersect. Beware of floating point errors.

Input
Each data set consists of a number 0 < K <= 20 on a line by itself, followed by a line of K space-separated numbers ai. Each number is in the range 0 < ai < 107, and has at most 3 digits after the decimal point.
The input will be terminated by a zero on a line by itself.

Output
For each test case, there should be one word on a line by itself; "YES" if it is possible to make a simple connected figure out of the given arcs, and "NO" if it isn’t.

Sample Input
1
4.000
2
1.000 1.000
3
1.455 2.958 4.424
7
1.230 2.577 3.411 2.968 5.301 4.398 6.777
0

Sample Output
NO
YES
NO
YES

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 微信公众号自制会员卡没有收款渠道啊
    • ¥15 stable diffusion
    • ¥100 Jenkins自动化部署—悬赏100元
    • ¥15 关于#python#的问题:求帮写python代码
    • ¥20 MATLAB画图图形出现上下震荡的线条
    • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
    • ¥15 perl MISA分析p3_in脚本出错
    • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
    • ¥15 ubuntu虚拟机打包apk错误
    • ¥199 rust编程架构设计的方案 有偿