正方形在坐标上的旋转的一个几何题,怎么使用C语言的程序编写的设计的代码去实现问题求解的

Problem Description
In this problem, you are given a sequence S1, S2, ..., Sn of squares of different sizes. The sides of the squares are integer numbers. We locate the squares on the positive x-y quarter of the plane, such that their sides make 45 degrees with x and y axes, and one of their vertices are on y=0 line. Let bi be the x coordinates of the bottom vertex of Si. First, put S1 such that its left vertex lies on x=0. Then, put S1, (i > 1) at minimum bi such that

bi > bi-1 and
the interior of Si does not have intersection with the interior of S1...Si-1.

The goal is to find which squares are visible, either entirely or partially, when viewed from above. In the example above, the squares S1, S2, and S4 have this property. More formally, Si is visible from above if it contains a point p, such that no square other than Si intersect the vertical half-line drawn from p upwards.

Input
The input consists of multiple test cases. The first line of each test case is n (1 ≤ n ≤ 50), the number of squares. The second line contains n integers between 1 to 30, where the ith number is the length of the sides of Si. The input is terminated by a line containing a zero number.

Output
For each test case, output a single line containing the index of the visible squares in the input sequence, in ascending order, separated by blank characters.

Sample Input
4
3 5 1 4
3
2 1 2
0

Sample Output
1 2 4
1 3

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问

相似问题

0
ENVI 风云2号G静止卫星 用经纬度查找表 Build GLT 报错
0
利用c语言及easy x制作一个坦克大战小游戏,要求代码简单基础,不超过800行最好
2
opencv用boundingrect找最大区域时崩溃
0
微信小程序优惠券锯齿边缘想弄成圆弧状 但是现在是正方形形状 怎么修改
1
C语言编程求解答如何写程序
1
C程序输出题目所要求的序列,序列中每个元素一行。如果存在两个符合要求的序列
0
正方形的可见性的判断问题,正方形在x轴上的投影怎么计算的?采用C编程语言
0
正方形的一个边界的判定的问题算法,用数据结构的C 语言编程的形式的解决方式
0
根据NC运用算法计算有多少种不同的棋盘,C语言编程的一种运用的问题
0
正方形的矩阵的一个算法的问题思路,用C语言的方式去计算怎么做
4
C语言打印正方形的代码
0
考虑泊松方程边值问题
0
判断四个点能否组成正方形的一个算法的问题,如何利用C语言程序的设计的方式来做
2
java 接口实现类编译显示不是抽象类,未覆盖抽象方法问题?
0
JAVA小白求救:坦克大战-多关卡咋做?没思路。。。
0
正方形在坐标系的排列的问题,运用C语言程序编写的思路实现过程的做法?
1
阴影的面积——C++程序,C++程序
2
圆形内接正方形-类——C++程序
1
Android位图采集的初级问题- -。
0
棋盘旋转有多少种不同的棋盘的问题,怎么使用C语言的程序编写的代码形式和过程来实现的程序