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的更多相关文章
随机推荐
- 关于WebSocket需要知道
WebSocket 概念 WebSocket是再单个TCP连接上进行双工通讯的协议,仅需要通过一次握手两个之间就可以创建持久性的连接,进行双向数据传输.WebSocket 是HTML5新增加的协议. ...
- C#ComboBox控件“设置 DataSource 属性后无法修改项集合”的解决方法
在使用ComboBox控件时,遇到了重新绑定赋值出问题的情况.正常情况下,对于数据重新赋值的或者绑定数据源的时候,为了防止数据出现问题,都会先清空原来数据,所以就这样写了,但是没有相当恰恰这样写就出现 ...
- SpringMVC 中 @ControllerAdvice 注解的三种使用场景!
@ControllerAdvice ,很多初学者可能都没有听说过这个注解,实际上,这是一个非常有用的注解,顾名思义,这是一个增强的 Controller.使用这个 Controller ,可以实现三个 ...
- Bumblebee之负载、限流和故障处理实践
Bumblebee作为标准HTTP 1.1应用协议的网关,它能作为任何基于HTTP 1.1构建Webapi服务的前置网关.以下通过示例讲述如何用Bumblebee来制作一个asp.net core w ...
- Java之mybatis详解
文章大纲 一.mybatis介绍二.mybatis代码实战三.项目源码下载四.参考文章 一.mybatis介绍 1. mybatis是什么? mybatis是一个持久层的框架,是apache下 ...
- 入门者必看!SharePoint之CAML总结(实战)
分享人:广州华软 无名 一. 前言 在SharePoint中,不支持直接操作数据库,但开发过程中,避免不了查询数据,那么,在SharePoint中如何查询数据? 当然是使用CAML语法. 二. 目录 ...
- PIC单片机基础2
PIC中档系列单片机,每条指令14位,共有35条汇编指令,根据操作对象不同,可将其分为三类: 字节操作类指令 位操作类指令 立即数与控制类操作指令 1.字节操作类指令,以MOVF指令为例: 指令:MO ...
- flink源码编译(windows环境)
前言 最新开始捣鼓flink,fucking the code之前,编译是第一步. 编译环境 win7 java maven 编译步骤 https://ci.apache.org/projects/f ...
- python word转pdf
原理 使用python win32 库 调用word底层vba,将word转成pdf 安装pywin32 pip install pywin32 python代码 from win32com.clie ...
- 基于python语言的tensorflow的‘端到端’的字符型验证码识别源码整理(github源码分享)
基于python语言的tensorflow的‘端到端’的字符型验证码识别 1 Abstract 验证码(CAPTCHA)的诞生本身是为了自动区分 自然人 和 机器人 的一套公开方法, 但是近几年的 ...