【HDU - 1943】Ball bearings(几何问题)

题干:

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

题目大意:

首先是一个t,表示输入实例数。以下每行是一个实例,有3个浮点正数,D,d,s。D是大圆的直径,d是小圆的直径,s是依序相邻的小圆之间的最小距离。所有参数都是在[0.0001, 500.0]范围内。

解题报告:

   直接计算出圆心角,然后PI/圆心角就可以了。

AC代码:

#include<cstdio>
#include<iostream>
#include<algorithm>
#include<queue>
#include<map>
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<cstring>
#define ll long long
#define pb push_back
#define pm make_pair
using namespace std;
const double PI = acos(-1.0);
int main()
{int t;cin>>t;double s,d,D;while(t--) {scanf("%lf%lf%lf",&D,&d,&s);printf("%d\n",(int)(PI/asin((d+s)/(D-d))));} return 0 ;
}

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/440568.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

mysql显示修改密码_MySQL修改密码

第一种方式&#xff1a;最简单的方法就是借助第三方工具Navicat for MySQL来修改&#xff0c;方法如下&#xff1a;1、登录mysql到指定库&#xff0c;如&#xff1a;登录到test库。2、然后点击上方“用户”按钮。3、选择要更改的用户名&#xff0c;然后点击上方的“编辑用户”按…

mysql 磁盘组_有效管理 ASM 磁盘组空间

ORA-15041: diskgroup space exhausted 对您的数据库环境的直接和间接影响&#xff1f;与 ASM 磁盘组相关的磁盘空间问题和 ORA-15041 错误会ORA-15041: diskgroup space exhausted 对您的数据库环境的直接和间接影响&#xff1f;与 ASM 磁盘组相关的磁盘空间问题和 ORA-15041 …

【HDU - 1561】The more, The Better(树形背包,dp,依赖背包问题与空间优化,tricks)

题干&#xff1a; ACboy很喜欢玩一种战略游戏&#xff0c;在一个地图上&#xff0c;有N座城堡&#xff0c;每座城堡都有一定的宝物&#xff0c;在每次游戏中ACboy允许攻克M个城堡并获得里面的宝物。但由于地理位置原因&#xff0c;有些城堡不能直接攻克&#xff0c;要攻克这些…

【CodeForces - 616C 】The Labyrinth点石成金(并查集,dfs)

题干&#xff1a; 小O无意间发现了一张藏宝图&#xff0c;它跟随藏宝图的指引来到了一个宫殿&#xff0c;宫殿的地板被分成了n*m块格子&#xff0c;每个格子上放置了金子或者石头 藏宝图告诉小O&#xff0c;它可以选择一块石头变成金子&#xff0c;并且带走与变化后的金子联通…

jsp mysql 推荐算法_基于jsp+mysql+Spring+mybatis的SSM协同过滤音乐推荐管理系统(个性化推荐)...

运行环境: 最好是java jdk 1.8&#xff0c;我们在这个平台上运行的。其他版本理论上也可以。IDE环境&#xff1a; Eclipse,Myeclipse,IDEA都可以tomcat环境&#xff1a; 最好是Tomcat 7.x,8.x,9.x版本均可&#xff0c;理论上Tomcat版本不是太老都可以。&#xff0c;我们在这个环…

项目进度计划甘特图_甘特图做项目进度计划的技巧?

原标题&#xff1a;甘特图做项目进度计划的技巧&#xff1f;甘特图怎么做项目进度计划&#xff1f;首先我们先了解一下&#xff0c;什么是甘特图。甘特图(Gantt chart)又称为横道图、条状图(Bar chart)&#xff0c;是由提出者亨利L甘特来命名的。甘特图通过条状图来显示项目&am…

wp config.php mysql_WordPress手动配置wp-config.php文件

前不久在WordPress技术群里看到有人在安装网站程序的时候出现了系统不能自动配置wp-config.php文件的问题&#xff0c;那么这个时候就需要我们手动进行配置了。问题描述&#xff1a;如果自动创建未能成功&#xff0c;不用担心&#xff0c;您要做的只是将数据库信息填入配置文件…

thinkphp使用echarts_Thinkphp 与Echarts-php 使用

这里推荐大家使用composer 依赖管理工具 导入Echarts-php库{"name": "hisune/echarts-php","version": "1.0.10","version_normalized": "1.0.10.0","source": {"type": "git",&qu…

创建文件夹 java_java怎么建文件夹

Java文件类以抽象的方式代表文件名和目录路径名。该类主要用于文件和目录的创建、文件的查找和文件的删除等。File对象代表磁盘中实际存在的文件和目录。下面我们来看一下java中创建文件夹的方法&#xff1a;示例&#xff1a;package com.zz;import java.io.File;import java.i…

【Gym - 101986F】Pizza Delivery(Dijkstra最短路,建图方式,反向建图,Tarjan求桥,图论模板)

题干&#xff1a; 题目大意&#xff1a; 一个有向图&#xff0c;编号1~n的n个点&#xff0c;m条边&#xff0c;规定1为起点&#xff0c;2为终点&#xff0c;问对于每一条边&#xff0c;反转它的方向&#xff0c;最短路会不会发生改变&#xff0c;如果变短了&#xff0c;输出HA…

【CF#505B】Mr. Kitayuta's Colorful Graph (并查集或Floyd或BFS)

题干&#xff1a; Mr. Kitayuta has just bought an undirected graph consisting of n vertices and m edges. The vertices of the graph are numbered from 1 to n. Each edge, namely edge i, has a color ci, connecting vertex ai and bi. Mr. Kitayuta wants you to p…

java data jpa_Spring Data JPA(一)简介

Spring Data JPA介绍可以理解为JPA规范的再次封装抽象&#xff0c;底层还是使用了Hibernate的JPA技术实现&#xff0c;引用JPQL(Java Persistence Query Language)查询语言&#xff0c;属于Spring整个生态体系的一部分。随着Spring Boot和Spring Cloud在市场上的流行&#xff0…

【CodeForces - 438D】The Child and Sequence(线段树区间取模操作)

题干&#xff1a; At the childrens day, the child came to Pickss house, and messed his house up. Picks was angry at him. A lot of important things were lost, in particular the favorite sequence of Picks. Fortunately, Picks remembers how to repair the sequ…

java 自定义xml_6.1 如何在spring中自定义xml标签

dubbo自定义了很多xml标签&#xff0c;例如&#xff0c;那么这些自定义标签是怎么与spring结合起来的呢&#xff1f;我们先看一个简单的例子。一 编写模型类1 packagecom.hulk.testdubbo.model;23 public classHero {4 privateString name;5 private intage;67 publicString ge…

java 模块设计模式_Java9模块化学习笔记二之模块设计模式

模块设计的原则:1、防止出现编译时循环依赖(主要是编译器不支持)&#xff0c;但运行时是允许循环依赖的&#xff0c;比如GUI应用2、明确模块的边界几种模块设计:API模块&#xff0c;聚合模块(比如java.base)可选依赖两种方式:1、可选的编译时依赖(类似于maven的provided scope)…

java 手写签名_Android 自定义View手写签名并保存图片

GIF压缩有问题&#xff0c;运行很顺滑&#xff01;&#xff01;&#xff01;1.自定义View——支持设置画笔颜色&#xff0c;画笔宽度&#xff0c;画板颜色&#xff0c;清除画板&#xff0c;检查是否有签名&#xff0c;保存画板图片(复制粘贴可直接使用)/*** Created by YyyyQ o…

【2019第十届蓝桥杯省赛C/C++B组题解】(非官方题解)

A。 数数题。 答案&#xff1a;490 B。 26进制模拟。 答案&#xff1a;BYQ C。 类似fib数列求值&#xff0c;递推一下就好。 答案&#xff1a;4659 D。 注意两个坑点&#xff0c;一个是正整数&#xff0c;所以枚举要从1开始。第二个坑点是互不相同的&#xff0c;为了达到这…

java对象模型 指令_深入理解多线程(二)—— Java的对象模型

上一篇文章中简单介绍过synchronized关键字的方式&#xff0c;其中&#xff0c;同步代码块使用monitorenter和monitorexit两个指令实现&#xff0c;同步方法使用ACC_SYNCHRONIZED标记符实现。后面几篇文章会从JVM源码的角度更加深入&#xff0c;层层剥开synchronized的面纱。在…

java 学生课程成绩_Java课设--学生成绩管理系统一

写在前面这个项目是Java课程的课设&#xff0c;一共花了5天的时间去完成它&#xff0c;在这期间感谢一些博主的帮助&#xff0c;让我了解到了一些新的技术知识&#xff0c;所以打算写这一系列博客来介绍一整个课设项目&#xff0c;也为了帮助之后的人&#xff0c;如有错误&…

java调用cplex案例_【CPLEX教程03】java调用cplex求解一个TSP问题模型

前面我们已经搭建好cplex的java环境了&#xff0c;相信大家已经跃跃欲试&#xff0c;想动手写几个模型了。今天就来拿一个TSP的问题模型来给大家演示一下吧~CPLEX系列教程可以关注我们的公众号哦&#xff01;获取更多精彩消息&#xff01;01 TSP寤烘ā关于TSP建模&#xff0c;就…