Convex 一道阿姆斯特朗回旋好题
Input
请看题目描述
Output
请看题目描述
Sample Input
4 1
90 90 90 90
6 1
60 60 60 60 60 60
Sample Output
2.000
2.598
Hint
#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm> using namespace std;
int main()
{
int t;
while(cin>>t&&t != )
{
while(t)
{
putchar(t%);
t/=;
}
}
}
翻译后题目为:
We have a special convex that all points have the same distance to origin point.
As you know we can get N segments after linking the origin point and the points on the convex. We can also get N angles between each pair of the neighbor segments.
Now give you the data about the angle, please calculate the area of the convex..
INPUT
There are multiple test cases.
The first line contains two integer N and D indicating the number of the points and their distance to origin. (3 <= N <= 10, 1 <= D <= 10)
The next lines contain N integers indicating the angles. The sum of the N numbers is always 360.
OUTPUT
For each test case output one float numbers indicating the area of the convex. The printed values should have 3 digits after the decimal point.
求三角形面积,用到公式s=0.5*a*b*sinc.
代码:
#include <bits/stdc++.h>
#define pi 3.1415926
using namespace std;
int main()
{
double sum = ,d;
int n,de[];
while(cin>>n>>d){
sum = ;
for(int i = ;i < n;i ++)
{
cin>>de[i];
sum += 0.5*d*d*sin(de[i]*pi/);
}
printf("%.3f\n",sum);
}
}
Convex 一道阿姆斯特朗回旋好题的更多相关文章
- 洛谷P2918 [USACO08NOV]买干草(一道完全背包模板题)
题目链接 很明显的一道完全背包板子题,做法也很简单,就是要注意 这里你可以买比所需多的干草,只要达到数量就行了 状态转移方程:dp[j]=min(dp[j],dp[j-m[i]]+c[i]) 代码如下 ...
- 又一道区间DP的题 -- P3146 [USACO16OPEN]248
https://www.luogu.org/problemnew/show/P3146 一道区间dp的题,以区间长度为阶段; 但由于要处理相邻的问题,就变得有点麻烦; 最开始想了一个我知道有漏洞的方程 ...
- [真题] 一道 vsftp 运维题
一道 vsftp 运维题 一.前言 在 V 站上凑巧看到了好友发的求助帖,五天时间一个理他的都没有.哈哈哈~ 废话不多说,我们来试试. 二.题目 这里我们假设存在这样的场景: 网络内有普通用户 ade ...
- QDUOJ 一道简单的数据结构题 栈的使用(括号配对)
一道简单的数据结构题 发布时间: 2017年6月3日 18:46 最后更新: 2017年6月3日 18:51 时间限制: 1000ms 内存限制: 128M 描述 如果插入“+”和“1”到 ...
- hihocoder第220周-一道拧巴的题
一.220周 题目链接 问题描述 键盘上有N个数字按键,每个按键只能按一次,每次可以按下多个键,请输出所有可能的按键情况. 输入一个整数N(N在1~8之间),输出全部的按键可能.例如:输入3,输出为 ...
- 刷题向》一道简单的思路题BZOJ1800(EASY+)
这道题其实并不难,主要原因是数据范围很小,当然数据如果大来也可以优化,但重点是在做的时候用的思路很通用, 所以本题是一道思想题(当然思想也不难) 标题里的“+”体现在一些边界处理中. 直接甩题目 De ...
- python基础===一道小学奥数题的解法
今早在博客园和大家分享了一道昨晚微博中看到的小学奥数题,后来有朋友给出了答案.然后我尝试用python解答它. 原题是这样的: 数学题:好事好 + 要做好 = 要做好事,求 “好.事.做.要”的值分别 ...
- 值得一做》关于一道DP+SPFA的题 BZOJ1003 (BZOJ第一页计划) (normal-)
这是一道数据范围和评测时间水的可怕的题,只是思路有点难想,BUT假如你的思路清晰,完全了解怎么该做,那就算你写一个反LLL和反SLE都能A,如此水的一道题,你不心动吗? 下面贴出题目 Descript ...
- 【BZOJ1036】[ZJOI2008] 树的统计Count(一道可怕的模板题:树剖+线段树)
点此看题面 题解 这真的只是一道模板题:一个树链剖分套上一个线段树(令我窒息的组合). 既然是模板题,那就直接上代码吧. 代码 #include<bits/stdc++.h> #defin ...
随机推荐
- 编程当道,学点Python技术好傍身
为了填满AI时代的人才缺口,编程语言教育都从娃娃抓起了!如果你还不懂Python是什么将来怎么给孩子辅导作业呢? Python新手入门教程 近期,浙江省信息技术课程改革方案出台,Python言语现已断 ...
- C题:A Water Problem(dp||搜索)
原题链接 解法一:递归 #include<cstdio> #include<algorithm> using namespace std; long long n,x,y; l ...
- 32Sql数据库的插入
上一节讲了数据库的连接,本例直接将数据库的插入操作,重点还是QSqlQuery类 QSqlQuery query; //新建二维表 query.exec("CREATE TABLE stud ...
- 解决com.mongodb.MongoException$CursorNotFound: cursor 0 not found on server
背景 经常需要执行脚本调用Java程序读取mongodb中数据,本来是转为后台进程.偶尔看看日志的简单任务.今天发现程序抛出异常“com.mongodb.MongoException$CursorNo ...
- 操作数据库的时候,使用自带的DbProviderFactory类 (涉及抽象工厂和工厂方法)
微软自带的DbProviderFactory https://msdn.microsoft.com/en-us/library/system.data.common.dbproviderfactory ...
- 【转载】Java关键字之"transient"
原文出处:http://blog.csdn.net/lanxuezaipiao/article/details/16358677 transient的作用及使用方法 我们都知道一个对象只要实现了Ser ...
- UVa 1658 海军上将(最小费用最大流)
https://vjudge.net/problem/UVA-1658 题意: 给出一个v个点e条边的有向加权图,求1~v的两条不相交(除了起点和终点外公共点)的路径,使得权和最小. 思路:把2到v- ...
- TCP协议和UDP协议区别
tcp协议:可靠的.面向连接的协议(eg:打电话).传输效率低全双工通信(发送缓存&接收缓存).面向字节流.使用TCP的应用:Web浏览器:文件传输程序 udp协议:不可靠的.无连接的服务,传 ...
- install ros-indigo-pcl-conversions
CMake Warning at /opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake: (find_package): Could not fi ...
- python 操作Excel表格,解压zip包,压缩zip包,目录遍历
import zipfile import os,shutil import openpyxl file_list_pos="" fileName="" zip ...