Poj1799
| Time Limit: 1000MS | Memory Limit: 30000K | |
| Total Submissions: 15082 | Accepted: 6675 |
Description
George B. wants to be more than just a good American. He wants to make his daddy proud and become a western hero. You know, like John Wayne.
But sneaky as he is, he wants a special revolver that will allow him to shoot more often than just the usual six times. This way he can fool and kill the enemy easily (at least that's what he thinks).
Problem
George has kidnapped ... uh, I mean ... "invited" you and will only let you go if you help him with the math. The piece of the revolver that contains the bullets looks like this (examples for 6 and 17 bullets):

There is a large circle with radius R and n little circles with radius r that are placed inside on the border of the large circle. George wants his bullets to be as large as possible, so there should be no space between the circles. George will decide how large the whole revolver will be and how many bullets it shall contain.Your job is, given R and n, to compute r.
Input
Output
Sample Input
4 4.0 6 4.0 17 3.14159 100 42 2
Sample Output
Scenario #1: 1.333 Scenario #2: 0.621 Scenario #3: 0.096 Scenario #4: 21.000
Source
#include<iostream>
#include<vector>
#include<cmath>
#include<iomanip>
using namespace std;
const double PI= acos(-1.0);
int main()
{
int N;
cin>>N;
vector<float>arr(N*2);
for(int i=0;i<arr.size();i++)
{
cin>>arr[i];
}
int counter =0;
for(int i=1;i<=N;i++)
{
cout<<"Scenario #"<<i<<":"<<endl;
float R=arr[counter];
int n=arr[counter+1];
float r;
r = (sin(PI/(n*1.0))* R) / (1+sin(PI/(n*1.0)));
cout<<setiosflags(ios::fixed);
cout<<setprecision(3)<<r<<endl<<endl;
counter+=2;
}
return 0;
}
Poj1799的更多相关文章
随机推荐
- C# 高性能 TCP 服务的多种实现方式
哎~~ 想想大部分园友应该对 "高性能" 字样更感兴趣,为了吸引眼球所以标题中一定要突出,其实我更喜欢的标题是<猴赛雷,C# 编写 TCP 服务的花样姿势!>. 本篇文 ...
- SSRS报表服务随笔(rdl报表服务)-报表参数
上一篇我们说了创建一个简单的显示报表,但在实际工作中,我们有很多要带条件的报表 现在先认识一下报表数据,首次打开SSDT,报表数据在窗口的左侧,要是找不到了,没关系,在工具栏-视图-最下面的报表数据 ...
- java并发编程(1) --并发基础及其锁的原理
引言 多线程的知识点是一个庞大的体现,对此也是一知半解.一直想系统的深入的学习多线程的知识,奈何一直没有找到机会,好吧,其实就是懒.最近在项目中接触到一个多并发的项目,在项目中踩了无数的坑.在此下定决 ...
- 简易版本vue的实现
用了Vue也有两年时间了,一直以来都是只知其然,不知其所以然,为了能更好的使用Vue不被Vue所奴役,学习一下Vue底层的基本原理. Vue官网有一段这样的介绍:当你把一个普通的JavaScript对 ...
- Android项目中独立Git项目分库后的编译调试时Gradle的配置
基于AS开发项目,对于特定的功能模块,往往抽取成独立的库进行管理,然后上传到Marven库中,通过Gradle依赖的方式进行引用. 其优势体现在: 1,独立的Git项目库,模块功能,及职责界定清晰: ...
- 玩转Spring Cloud之服务注册发现(eureka)及负载均衡消费(ribbon、feign)
如果说用Spring Boot+Spring MVC是开发单体应用(或单体服务)的利器,那么Spring Boot+Spring MVC+Spring Cloud将是开发分布式应用(快速构建微服务)的 ...
- Spring Boot入门(三):使用Scheduled注解实现定时任务
在程序开发的过程中,经常会使用定时任务来实现一些功能,比如: 系统依赖于外部系统的非核心数据,可以定时同步 系统内部一些非核心数据的统计计算,可以定时计算 系统内部的一些接口,需要间隔几分钟或者几秒执 ...
- 常用的Java Keytool Keystore命令
Java keytool是密钥和证书管理工具.它使用户能够管理自己的公钥/私钥对及相关证书,用于(通过数字签名)自我认证(用户向别的用户/服务认证自己)或数据完整性以及认证服务.它还允许用户储存他们的 ...
- js 异步转同步
在项目中有些逻辑或者请求依赖另一个异步请求,大家常用的方法是回调函数.现在有个高大上的解决方案:await async . async 是“异步”的简写,而 await 可以认为是 async wai ...
- svn版本控制迁移到git
获得原 SVN 仓库使用的作者名字列表 因为导入到git需要配置原作者(svn提交人)和git账户的映射关系 其格式为: vim authors-transform.txt taoxs = xsTao ...