ural 1020 Rope
#include <cstdio>
#include <cstring>
#include <cmath>
#include <algorithm>
#define maxn 2000
using namespace std;
const double pi=acos(-1.0); double sqr(double x)
{
return x*x;
}
struct node
{
double x,y;
}p[maxn]; double dis(node a,node b)
{
return sqrt(sqr(a.x-b.x)+sqr(a.y-b.y));
}
int main()
{
int n;
double r;
scanf("%d%lf",&n,&r);
for(int i=; i<n; i++)
{
scanf("%lf%lf",&p[i].x,&p[i].y);
}
p[n]=p[];
double ans=;
for(int i=; i<=n; i++)
{
ans+=dis(p[i],p[i-]);
}
ans+=pi*r*;
printf("%.2lf\n",ans);
return ;
}
ural 1020 Rope的更多相关文章
- URAL 1145—— Rope in the Labyrinth——————【求树的直径】
Rope in the Labyrinth Time Limit:500MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64 ...
- ural 1145. Rope in the Labyrinth
1145. Rope in the Labyrinth Time limit: 0.5 secondMemory limit: 64 MB A labyrinth with rectangular f ...
- ural 1246. Tethered Dog
1246. Tethered Dog Time limit: 1.0 secondMemory limit: 64 MB A dog is tethered to a pole with a rope ...
- Ural State University Internal Contest October'2000 Junior Session
POJ 上的一套水题,哈哈~~~,最后一题很恶心,不想写了~~~ Rope Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7 ...
- [bzoj3673][可持久化并查集 by zky] (rope(可持久化数组)+并查集=可持久化并查集)
Description n个集合 m个操作 操作: 1 a b 合并a,b所在集合 2 k 回到第k次操作之后的状态(查询算作操作) 3 a b 询问a,b是否属于同一集合,是则输出1否则输出0 0& ...
- 谈c++ pb_ds库(一)rope大法好
参考资料 1)官方说明 支持 sorry,cena不支持rope 声明 1)头文件 #include<ext/rope> 2)调用命名空间 using namespace __gnu_cx ...
- [bzoj1269][AHOI2006文本编辑器editor] (splay模版题 or pb_ds [rope]大法)
Description 这些日子,可可不和卡卡一起玩了,原来可可正废寝忘食的想做一个简单而高效的文本编辑器.你能帮助他吗?为了明确任务目标,可可对“文本编辑器”做了一个抽象的定义: 文本:由0个或 ...
- 后缀数组 POJ 3974 Palindrome && URAL 1297 Palindrome
题目链接 题意:求给定的字符串的最长回文子串 分析:做法是构造一个新的字符串是原字符串+反转后的原字符串(这样方便求两边回文的后缀的最长前缀),即newS = S + '$' + revS,枚举回文串 ...
- ural 2071. Juice Cocktails
2071. Juice Cocktails Time limit: 1.0 secondMemory limit: 64 MB Once n Denchiks come to the bar and ...
随机推荐
- Mutex — Windows API
Mutex是互斥体的意思,当一个线程持有一个Mutex时,其它线程申请持有同一个Mutex会被阻塞,因此可以通过Mutex来保证对某一资源的互斥访问(即同一时间最多只有一个线程访问).调用Create ...
- raid5什么意思?怎样做raid5?raid5 几块硬盘?
一.raid什么意思? RAID是"Redundant Array of Independent Disk"的缩写,raid什么意思了?说白了,中文翻译过来通俗的讲就是磁盘阵列的意 ...
- HDU 2639 Bone Collector II(01背包变型)
此题就是在01背包问题的基础上求所能获得的第K大的价值. 详细做法是加一维去推当前背包容量第0到K个价值,而这些价值则是由dp[j-w[ i ] ][0到k]和dp[ j ][0到k]得到的,事实上就 ...
- [Redux] Introduction
Single immutable state tree: Should be just one single javascript object. Describing the changes by ...
- C++虚函数及虚函数表解析
一.背景知识(一些基本概念) 虚函数(Virtual Function):在基类中声明为 virtual 并在一个或多个派生类中被重新定义的成员函数.纯虚函数(Pure Virtual Functio ...
- java.net.MulticastSocket Example--reference
In this example we are going to explain how to use MulticastSocket in Java, in order to enable a ser ...
- MVC项目,系统找不到指定的文件。(异常来自 HRESULT:0x80070002)
今天在用Visual Studio新建MVC项目的时候,遇到错误 系统找不到指定的文件.(异常来自 HRESULT:0x80070002) 解决办法:工具--> 扩展和更新 -->联机(V ...
- zookeeper管理solr的配置文件
zookeeper可以管理solr和其他软件的配置文件.配置文件还是保存在linux服务器的磁盘上,但是不是改变solr读取solr/home配置的配置文件的位置. 现在solr/home配置文件的位 ...
- c - 给分数分级别
/* 题目: 学习成绩>=90 分的同学用 A 表示, 80-89 分之间的用 B 表示,70-79 分的用 C 表示, 60-69 分用 D表示,小于60分用E表示. 分析: 使用swith. ...
- 批处理备份和恢复mysql数据库
备份 set "Ymd=%date:~,4%%date:~5,2%%date:~8,2%%time:~0,2%%time:~3,2%%time:~6,2%" md "D: ...