被这题卡了一个月。。因为没有看清题目。。圆在斜线上的速度是角速度为1.我一直以为是一样的速度。。。。。
英语这么挫。过阵子怎么找工作啊。。。
代码:
#include <iostream> #include <cstdio> #include <cstring> #include <queue> #include <stack> #include <algorithm> #include <cmath> #include <map> #define LL long long #define DB double using namespace std; const DB PI = acos(-1.0); struct cycle{ DB x,y,r; void get(){scanf("%lf%lf%lf",&x,&y,&r);} }; DB dist(cycle a,cycle b) { return sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); } int main() { #ifndef ONLINE_JUDGE freopen("in.txt","r",stdin); #endif cycle a,c,b; int cas,T=1;scanf("%d",&cas); while(cas--) { a.get();b.get();c.get(); if(a.y-a.r>b.y-b.r) swap(a,b); DB d = dist(a,b); DB alph = atan((b.y-a.y)/fabs(b.x-a.x))-asin((b.r-a.r)/d); DB low = a.y - a.r/cos(alph); DB d1 = c.y - low-fabs(c.x-a.x)*tan(alph)-c.r/cos(alph); DB d2; if(fabs(a.y-a.r-b.y+b.r)<0.1) { d2 = 0; }else { DB l1 = sqrt((a.r+c.r)*(a.r+c.r)-(a.r-c.r)*(a.r-c.r)); d2 = fabs(a.x-c.x)/cos(alph)+c.r*tan(alph)-a.r*tan(alph) - l1; d2 = d2/c.r/2/PI; } printf("Case %d: %.10lf\n",T++,d1+d2); } return 0; }