编程介的小学生 2017-10-26 02:43 采纳率: 20.3%
浏览 930
已采纳

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

  • 写回答

1条回答 默认 最新

报告相同问题?

悬赏问题

  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊
  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写