编程介的小学生 2019-09-14 21:34 采纳率: 20.5%
浏览 163

Disks 是如何编写的呢

Description

Consider N floating point numbers N representing the radii of N disks. We fix a disk in the xOy system, if we position it at a positive coordinate x (big enough), tangential to the 0x axis and above it and after that we push it to 0y until it becomes tangent to 0y or to the first disk that it meets on the way. In the configuration that results by fixing in order all the given disks, some of them can be considered as being dispensible, because, if we eliminate them, the total width of the configuration is the same, which means that there is no disk that can be moved to the left.

Identify all the indispensible disks for a given configuration (in the configuration from above; the gray disks are dispensible).
Input

The input has the following structure:
the first line contains N ( N <= 1000), the number of disks;
the next N lines contain N real numbers representing the radii of the disks, in the order they are fixed in the configuration.

Output

The output will have the following structure:
the first line will contain an integer K, representing the number of dispensable disks;
each of the next K lines will contain the order number of the dispensable disks.
Sample Input

7
4
0.1
0.5
3
0.5
4
1
Sample Output

3
2
3
5

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料