题目链接:hdu 5476

  今天和队友们搞出3道水题后就一直卡在这儿了,唉,真惨啊……看着被一名一名地挤出晋级名次,确实很不好受,这道恶心的几何题被我们3个搞了3、4个小时,我想到一半时发现样例输出是 (√2) π / 2 + 1, 于是就各种 YY,无奈尝试了各种方法还是免不了 wa。。。

  后来在网上发现,那段圆弧其实就和自己插身而过,真的可以说差一点就想到了,无奈到了最后我们几个都精疲力尽了,好像也想不出什么了。看下图:

   就是三角形里的圆弧的长度,设为 Lc ,很容易得出 Lc = | OC | * 2 * ∠O,而 ∠O = ∠ACM,∠ACM可以由 | AM | 与 | CM | 的 atan 值求出,而 | OC | = | CM | / sin(∠O),所以,核心代码就几行而已:  

 #include<cstdio>
#include<cstring>
#include<algorithm>
#include<cmath>
using namespace std; struct point {
double x,y;
point() {}
point(double x, double y): x(x), y(y) {}
void read() { scanf("%lf %lf",&x,&y); }
void readint() {
int x,y;
scanf("%d %d",&x,&y);
this->x = x;
this->y = y;
}
point operator + (const point &p2) const {
return point(x + p2.x, y + p2.y);
}
point operator - (const point &p2) const {
return point(x - p2.x, y - p2.y);
}
point operator * (double p) const {
return point(x * p, y * p);
}
point operator / (double p) const {
return point(x / p, y / p);
}
}; typedef point Vector;
typedef const point& cpoint;
typedef const Vector& cvector; point operator * (double p, Vector a) {
return a * p;
} double dot(cvector a, cvector b) {
return a.x * b.x + a.y * b.y;
} double length(cvector a) {
return sqrt(dot(a,a));
} double angle(cvector a, cvector b) {
return acos(dot(a,b) / length(a) / length(b));
} double cross(cvector a, cvector b) {
return a.x * b.y - a.y * b.x;
} const double PI = acos(-1.0); int main() {
int t, Case = ;
point a,b,c;
scanf("%d",&t);
while(t--) {
a.readint();
b.readint();
c.readint();
point m = (b + c) / ;
double am = length(m - a), cm = length(m - c);
double angO = atan(am / cm);
double oc = cm / sin(angO);
double ans = oc * * angO + am;
printf("Case #%d: %.4f\n",++Case,ans);
}
return ;
}

  附上证明截图:(刚刚看懂,好强大~~ Orz Orz)

hdu 5476 Explore Track of Point(2015上海网络赛)的更多相关文章

  1. HDU 5476 Explore Track of Point 数学平几

    Explore Track of Point Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem ...

  2. 2015上海网络赛 HDU 5478 Can you find it 数学

    HDU 5478 Can you find it 题意略. 思路:先求出n = 1 时候满足条件的(a,b), 最多只有20W对,然后对每一对进行循环节判断即可 #include <iostre ...

  3. hdu 5475 模拟计算器乘除 (2015上海网赛H题 线段树)

    给出有多少次操作 和MOD 初始值为1 操作1 y 表示乘上y操作2 y 表示除以第 y次操作乘的那个数 线段树的叶子结点i 表示 第i次操作乘的数 将1替换成y遇到操作2 就把第i个结点的值 替换成 ...

  4. 2015上海网络赛 HDU 5475 An easy problem 线段树

    题意就不说了 思路:线段树,维护区间乘积.2操作就将要除的点更新为1. #include<iostream> #include<cstdio> #include<cstr ...

  5. 2015上海网络赛 A Puzzled Elena

    题意:给定一棵树,求这个节点的所有子树中包括他本身与它互质的节点的个数. 解题思路:题利用dfs序+容斥原理+前缀和性质解决.题目中要求每个结点,和多少个它的子结点互素.如果每次为了求一个点去跑一遍d ...

  6. 2015北京网络赛 D-The Celebration of Rabbits 动归+FWT

    2015北京网络赛 D-The Celebration of Rabbits 题意: 给定四个正整数n, m, L, R (1≤n,m,L,R≤1000). 设a为一个长度为2n+1的序列. 设f(x ...

  7. 2015北京网络赛 J Scores bitset+分块

    2015北京网络赛 J Scores 题意:50000组5维数据,50000个询问,问有多少组每一维都不大于询问的数据 思路:赛时没有思路,后来看解题报告也因为智商太低看了半天看不懂.bitset之前 ...

  8. 2015北京网络赛 Couple Trees 倍增算法

    2015北京网络赛 Couple Trees 题意:两棵树,求不同树上两个节点的最近公共祖先 思路:比赛时看过的队伍不是很多,没有仔细想.今天补题才发现有个 倍增算法,自己竟然不知道.  解法来自 q ...

  9. ACM学习历程—HDU5476 Explore Track of Point(平面几何)(2015上海网赛09题)

    Problem Description In Geometry, the problem of track is very interesting. Because in some cases, th ...

随机推荐

  1. C++中关于cin、cin.get()、cin.getline()、getline()、gets()等函数的用法

    1.cin>> 用法1:最基本,也是最常用的用法,输入一个数字: 注意:>> 是会过滤掉不可见的字符(如 空格 回车,TAB 等) cin>>noskipws> ...

  2. Linux学习之八——利用变量

    一.变量的使用 用$放在变量前面进行使用,例如: echo $PATH 为了和别的字符隔开,可以用{}和"",例如 echo ${PATH}nic echo "$PATH ...

  3. Android动画之Interpolator和AnimationSet

    AnimationSet可以加入Animation,加入之后设置AnimationSet对加入的所有Animation都有效. AnimationSet anim=new AnimationSet(t ...

  4. Python学习笔记-Day3-文件操作

    open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True) 打开文件并返回一个 ...

  5. shell 中的>文件重定向符 和 标准输入、输出、错误以及 2&1 的含义*

    http://www.cnblogs.com/chenmh/p/5382044.html 问:其中 的2>&1是怎么回事? . test.sh > test.log 2>&a ...

  6. BZOJ 3564 信号增幅仪

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=3564 题意:给出平面上n个点,画出一个椭圆,椭圆的长轴是短轴的p倍,且长轴的方向为x轴逆时 ...

  7. 。JavaSE------初识Java

    我的老师告诉我,命运眷顾有志者,天道酬勤. 有时在梦里幻想的再多终究也只是梦, 不如脚踏实地一步步往前走来的踏实. ------------------------------------------ ...

  8. UVA 590 二十一 Always on the run

     Always on the run Time Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu Submit ...

  9. C#获取百度新歌TOP50

    先上软件效果图 代码如下1.根据Url地址得到网页的html源码 public static string GetWebContent(string Url) { string strResult = ...

  10. vi及缩进设置

    set autoindent,把当前行的对起格式应用到下一行: set smartindent,智能的选择对起方式: set tabstop=4,设置tab键为4个空格: set shiftwidth ...