循环队列在旋转数组上的运用问题,怎么利用C语言的程序的设计的技术实现

Problem Description
The Swedish company SKF makes ball bearings. As explained by Britannica Online, a ball bearing is “one of the two types of rolling, or anti friction, bearings (the other is the roller bearing).

Its function is to connect two machine members that move relative to one another so that the frictional resistance to motion is minimal. In many applications, one of the members is a rotating shaft and the other a fixed housing. Each ball bearing has three main parts: two grooved, ring like races and a number of balls. The balls fill the space between the two races and roll with negligible friction in the grooves. The balls may be loosely restrained and separated by means of a retainer or cage.”
Presumably, the more balls you have inside the outer ring, the smoother the ride will be, but how many can you t within the outer ring? You will be given the inner diameter of the outer ring, the diameter of the balls, and the minimum distance between neighboring balls. Your task is to compute the maximum number of balls that will t on the inside of the outer ring (all balls must touch the outer ring).

Input
The first line of input contains a positive integer n that indicates the number of test cases. Then follow n lines, each describing a test case. Each test case consists of three positive oating point numbers, D, d, s, where D is the inner diameter of the outer ring, d is the diameter of a ball, and s is the minimum distance between balls. All parameters are in the range [0.0001, 500.0].

Output
For each test case output a single integer m on a line by itself, where m is the maximum number of balls that can t in the ball bearing, given the above constraints. There will always be room for at least three balls.

Sample Input
2
20 1 0.1
100.0 13.0 0.2

Sample Output
54
20

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

相似问题

1
Disruptor队列进行update写入数据的问题
3
python多进程队列问题
1
问题 C: 孤岛营救问题【队列 搜索 BFS】。
2
循环队列头元素删不掉?
3
rabbitmq 怎么实现多个消费者同时接收一个队列的消息?
1
C语言实现双队列问题,怎么做的?
0
顺序存储循环队列 希望大佬帮我回答一下 谢谢谢
0
IBM websphere MQ 服务端应用同一队列 如何避免 自己 put 之后 自己 get
1
这个问题使用优先级排序的队列思想方式怎么实现的,要求C语言解释
0
双队列实现堆栈方面的一个问题,这里的队列是优先级队列的话怎么实现,C语言谢谢
0
使用循环链表实现一个双向队列并且实现出队列和进队列的编程算法, 使用C语言的编程?
0
一个队列的表示方式问题,实现队列的入队和出队,要求是使用的C语言的程序实现
0
采用循环队列的链表实现的方式的环路的设计,数据结构C语言习题的思路
1
有关于消息队列的问题?
0
三元组队列的查询的算法,采用C语言编程的技术的实现的方式
0
使用数据结构后中的队列的方式能不能解决这里的排序的算法问题,运用C语言的知识
0
双队列+停止请求编码的问题,如何利用C语言技术的形式的实现
1
素数的队列的计算问题的算法,采用C语言的编程计算实现它
1
特殊的队列~删除队列的中间元素
0
循环队列的旋转的一个算法问题怎么利用C语言的程序的编写来求解的