standing

2bc*cosA=b^2+c^2-a^2

#include<cstdio>
#include<cstring>
#include<iostream>
#include<cmath>
#include<algorithm>
using namespace std;
const double pi=3.1415926535898;//我不明白他为什么会卡精度
int t;
double x1,y,r1,x2,y2,r2,s,a,b,c,k,m,w,p;
int main()
{
    scanf("%d",&t);
    while(t--)
    {
        scanf("%lf%lf%lf%lf%lf%lf",&x1,&y,&r1,&x2,&y2,&r2);
        double d=sqrt((x2-x1)*(x2-x1)+(y2-y)*(y2-y);
        if(d>=(r1+r2))//两圆相离
            s=pi*r1*r1+pi*r2*r2;
        else
          if(d<abs(r1-r2))//两圆内含
            s=max(pi*r1*r1,pi*r2*r2);
        else//两圆相交
          {
            s=r1*r1*pi+pi*r2*r2;
            k=sqrt((x1-x2)*(x1-x2)+(y-y2)*(y-y2));

            w=(r1*r1+k*k-r2*r2)/(2*r1*k);
            p=2*acos(w);
            s-=((p*r1*r1)/2-sin(p)*r1*r1/2);

            w=(r2*r2+k*k-r1*r1)/(2*r2*k);
            p=2*acos(w);
            s-=((p*r2*r2)/2-sin(p)*r2*r2/2);
         }
        printf("%.3lf\n",s);
    }
    return 0;
}

只要数学学得好代码就打得好

时间: 2024-12-13 07:24:58

standing的相关文章

this.standing

this.standing水平走的时候是true,纵向有速度是false,斜面轻微纵向速度也true var accel = this.standing ? this.accelG: this.accelA; if (this.currentAnim === this.anims.run && !this.sounds.walk.looping) { this.sounds.walk.loop(); } if (this.currentAnim !== this.anims.run &am

Where Are You Standing?

/*********************************************************************** * Where Are You Standing? * 说明: * 简单的画一下目前所接触到的东西网络结构 * * 2016-7-23 深圳 南山平山村 曾剑锋 **********************************************************************/

GCJ 2015Q(Standing Ovation-贪心)

Problem It's opening night at the opera, and your friend is the prima donna (the lead female singer). You will not be in the audience, but you want to make sure she receives a standing ovation -- with every audience member standing up and clapping th

[USACO17DEC]Standing Out from the Herd

[USACO17DEC]Standing Out from the Herd 题目描述 Just like humans, cows often appreciate feeling they are unique in some way. Since Farmer John's cows all come from the same breed and look quite similar, they want to measure uniqueness in their names. Eac

Codeforces 124A - The number of positions

题目链接:http://codeforces.com/problemset/problem/124/A Petr stands in line of n people, but he doesn't know exactly which position he occupies. He can say that there are no less than a people standing in front of him and no more than b people standing b

Codeforces Round #393 (Div. 2)

A. Petr and a calendar time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Petr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to wee

POJ3048 Max Factor

本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000作者博客:http://www.cnblogs.com/ljh2000-jump/转载请注明出处,侵权必究,保留最终解释权!   Description To improve the organization of his farm, Farmer John labels each of his N (1 <= N <= 5,000) cows with a distinct s

清北学堂 站军姿

/*2bc*cosA=b^2+c^2-a^2 模拟计算 50分*/ #include<iostream> #include<cstdio> #include<cmath> using namespace std; const double t=3.1415926535898; int n; double a,b,c,x,y,z,x2,y2,z2,s,k,m,w,p; int main () { freopen ("standing.in","

IaaS, PaaS和SaaS公司都做些什么

原文链接:http://www.leiphone.com/news/201406/iaas-paas-and-saas.html "云服务"现在已经快成了一个家喻户晓的词了.如果你不知道PaaS, IaaS 和SaaS的区别,那么也没啥,因为很多人确实不知道.(做了半年SaaS的我也是在介绍项目时候才听到这个SaaS,他们都把这个读作"萨斯",我的第一反应是当年那个病毒..) "云"其实是互联网的一个隐喻,"云计算"其实就是使