题目链接:http://codeforces.com/problemset/problem/507/B

题目意思:给出圆的半径,以及圆心坐标和最终圆心要到达的坐标位置。问最少步数是多少。移动见下图。(通过圆上的边固定转动点,然后转动任意位置,圆心就会移动了,这个还是直接看图吧)

解题的思路就是,两点之间,距离最短啦~~~~要想得到最少步数,我们需要保证圆心在这条连线上移动,每次转动的角度是180度,而每步移动的距离是2r,直到两个圆交叉,要注意最后一步转动的角度可能会小于180度。最后就是注意精度啦,用天花板函数ceil()吧,否则精度会被舍弃,最后一步实质上根本没有算进去!~~~~更详细的解题思路请参考官方题解。

http://codeforces.com/blog/entry/15975

 #include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std; typedef __int64 ll; int main()
{
ll r, x, y, x1, y1;
while (cin >> r >> x >> y >> x1 >> y1) {
ll difx = (x-x1)*(x-x1);
ll dify = (y-y1)*(y-y1);
ll ans = ceil(sqrt(difx + dify) / (*r));
printf("%I64d\n", ans);
}
return ;
}

codeforces 507B. Amr and Pins 解题报告的更多相关文章

  1. CodeForces - 507B - Amr and Pins(计算几何)

    Amr loves Geometry. One day he came up with a very interesting problem. Amr has a circle of radius r ...

  2. Codeforces Educational Round 92 赛后解题报告(A-G)

    Codeforces Educational Round 92 赛后解题报告 惨 huayucaiji 惨 A. LCM Problem 赛前:A题嘛,总归简单的咯 赛后:A题这种**题居然想了20m ...

  3. codeforces 476C.Dreamoon and Sums 解题报告

    题目链接:http://codeforces.com/problemset/problem/476/C 题目意思:给出两个数:a 和 b,要求算出 (x/b) / (x%b) == k,其中 k 的取 ...

  4. Codeforces Round #382 (Div. 2) 解题报告

    CF一如既往在深夜举行,我也一如既往在周三上午的C++课上进行了virtual participation.这次div2的题目除了E题都水的一塌糊涂,参赛时的E题最后也没有几个参赛者AC,排名又成为了 ...

  5. Codefores 507B Amr and Pins

    B. Amr and Pins time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...

  6. codeforces 500B.New Year Permutation 解题报告

    题目链接:http://codeforces.com/problemset/problem/500/B 题目意思:给出一个含有 n 个数的排列:p1, p2, ..., pn-1, pn.紧接着是一个 ...

  7. codeforces B. Xenia and Ringroad 解题报告

    题目链接:http://codeforces.com/problemset/problem/339/B 题目理解不难,这句是解题的关键 In order to complete the i-th ta ...

  8. codeforces 462C Appleman and Toastman 解题报告

    题目链接:http://codeforces.com/problemset/problem/461/A 题目意思:给出一群由 n 个数组成的集合你,依次循环执行两种操作: (1)每次Toastman得 ...

  9. codeforces 460A Vasya and Socks 解题报告

    题目链接:http://codeforces.com/problemset/problem/460/A 题目意思:有一个人有 n 对袜子,每天早上会穿一对,然后当天的晚上就会扔掉,不过他会在 m 的倍 ...

随机推荐

  1. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

  2. python __future__ package的几个特性

    我学习python过程, 和学习其它编程知识一样, 不是先读大部头书系统学习, 而是看博客和直接实践, 慢慢将这些知识点连成线, 再扩展到面. 这个过程缺点和优点都很明显. 缺点是, 有些知识点可能因 ...

  3. 微信获取nickname中存在Emoji导致保存为空问题的解决

    微信开发时候,有些用户使用Emoji表情作为用户昵称,导致数据库保存昵称时候不识别导致昵称为空,现在提出以下解决方案: /** +----------------------------------- ...

  4. jQuery 请指出'$'和'$.fn'的区别?或者说出'$.fn'的用途。

    ---------------------------------------------------------------------------------- 我们先把jQuery看成了一个类, ...

  5. [译]管理IIS日志的存储

    原文:http://www.iis.net/learn/manage/provisioning-and-managing-iis/managing-iis-log-file-storage Overv ...

  6. 360随身WIFI程序单文件绿色版及网卡驱动(附使用感受)

    大家好,我是Colin,今天刚收到传说中的360WIFI,拿到手后马上就进行了测试.就做工而言,19.9的价格算是比较公道的,网卡很小,做工还可以,带磨砂质感,而且还提供了一个耳机插头,可以当挂件一样 ...

  7. poj3070 Fibonacci

    Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = Fn − 1 + Fn − 2 for n ≥ 2. F ...

  8. SRM 513 2 1000CutTheNumbers(状态压缩)

    SRM 513 2 1000CutTheNumbers Problem Statement Manao has a board filled with digits represented as St ...

  9. VM虚拟机下安装Centos7.0图文教程

    新建虚拟机的相关配置,LZ使用的是VMware workstation 10.2 ,(其它版本也ok的),配置见下图.. PS: 打开虚拟机之后,提示了一个小错误,LZ根据错误提示,到BIOS里面设置 ...

  10. int (*p)[4] 与 int* p[4]

    碰到一道题: ][] = {,,,,,,,,,,,}; ]; ] = (a+); cout<<*(p+)<<endl; cout<<(*ptr+)[]<< ...