Codeforces Round #287 (Div. 2) B. Amr and Pins 水题
1 second
256 megabytes
standard input
standard output
Amr loves Geometry. One day he came up with a very interesting problem.
Amr has a circle of radius r and center in point (x, y). He wants the circle center to be in new position (x', y').
In one step Amr can put a pin to the border of the circle in a certain point, then rotate the circle around that pin by any angle and finally remove the pin.
Help Amr to achieve his goal in minimum number of steps.
Input consists of 5 space-separated integers r, x, y, x' y' (1 ≤ r ≤ 105, - 105 ≤ x, y, x', y' ≤ 105), circle radius, coordinates of original center of the circle and coordinates of destination center of the circle respectively.
Output a single integer — minimum number of steps required to move the center of the circle to the destination point.
2 0 0 0 4
1
1 1 1 4 4
3
4 5 6 5 6
0
In the first sample test the optimal way is to put a pin at point (0, 2) and rotate the circle by 180 degrees counter-clockwise (or clockwise, no matter).
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 100001
const int inf=0x7fffffff; //无限大
int main()
{
double r,x,y,x1,y1;
cin>>r>>x>>y>>x1>>y1;
double dis=(x-x1)*(x-x1)+(y-y1)*(y-y1);
dis=sqrt(dis);
double i;
for(i=;i<;i++)
{
if((i*r)>=dis/)
break;
}
cout<<i<<endl;
}
Codeforces Round #287 (Div. 2) B. Amr and Pins 水题的更多相关文章
- Codeforces Round #287 (Div. 2) A. Amr and Music 水题
A. Amr and Music time limit per test 1 second memory limit per test 256 megabytes input standard inp ...
- codeforcfes Codeforces Round #287 (Div. 2) B. Amr and Pins
B. Amr and Pins time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- Codeforces Round #297 (Div. 2)A. Vitaliy and Pie 水题
Codeforces Round #297 (Div. 2)A. Vitaliy and Pie Time Limit: 2 Sec Memory Limit: 256 MBSubmit: xxx ...
- Codeforces Round #290 (Div. 2) A. Fox And Snake 水题
A. Fox And Snake 题目连接: http://codeforces.com/contest/510/problem/A Description Fox Ciel starts to le ...
- Codeforces Round #322 (Div. 2) A. Vasya the Hipster 水题
A. Vasya the Hipster Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/581/p ...
- Codeforces Round #373 (Div. 2) B. Anatoly and Cockroaches 水题
B. Anatoly and Cockroaches 题目连接: http://codeforces.com/contest/719/problem/B Description Anatoly liv ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos 水题
A. Brain's Photos 题目连接: http://www.codeforces.com/contest/707/problem/A Description Small, but very ...
- Codeforces Round #359 (Div. 2) A. Free Ice Cream 水题
A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adve ...
- Codeforces Round #355 (Div. 2) A. Vanya and Fence 水题
A. Vanya and Fence 题目连接: http://www.codeforces.com/contest/677/problem/A Description Vanya and his f ...
随机推荐
- 用C代码简要模拟实现一下RPC(远程过程调用)并谈谈它在代码调测中的重要应用【转】
转自:http://blog.csdn.net/stpeace/article/details/44947925 版权声明:本文为博主原创文章,转载时请务必注明本文地址, 禁止用于任何商业用途, 否则 ...
- video标签、audio标签
1.video标签 <video src="nans.mp4" controls="controls" autoplay="autoplay& ...
- MyEclipse中Source not found的问题
1.问题描述 在MyEclipse中想查看源码,结果显示:Source not found ......(大概的意思就是找不到源码包) 2.解决方案 下载相应版本的apache-tomcat-8.5. ...
- java基础18 String字符串和Object类(以及“equals” 和 “==”的解析)
一.String字符串 问:笔试题:new String("abc")创建了几个对象?答:两个对象,一个对象是 位于堆内存,一个对象位于字符串常量池 class Demo17 { ...
- 读书笔记--C陷阱与缺陷(三)
第三章 1. 指针与数组 书中强调C中数组注意的两点: 1) C语言只有一维数组,但是数组元素可以是任何类型对象,是另外一个数组时就产生了二维数组.数组大小是常数(但GCC实现了变长数组..) ...
- 练习题 --- 10种Xpath定位
写出10种不同的Xpath定位语法
- python2.7
python2.7支持win32.win64 下载地址:http://pan.baidu.com/s/1dE39eQ9 初学,附一个牛人的python教程地址:http://www.liaoxuefe ...
- ****jQuery - 设置HTML内容和属性
设置内容 - text().html() 以及 val() 我们将使用前一章中的三个相同的方法来设置内容: text() - 设置或返回所选元素的文本内容 html() - 设置或返回所选元素的内容( ...
- Kubernetes1.6集群上(开启了TLS)安装Dashboard
本节内容: 配置dashboard 执行所有定义的文件 检查执行结果 访问dashboard 这是接着上一篇<二进制方式部署Kubernetes 1.6.0集群(开启TLS)>写的.Kub ...
- 【洛谷】P2179 [NOI2012]骑行川藏
题解 感谢小迪给我讲题啊,这题小迪写挺好的我就不写了吧 小迪的题解 代码 #include <iostream> #include <cstdio> #include < ...