https://www.educoder.net/paths/kjvfxps8
A Satellites
大意就是给定两个卫星到地球距离,都是一样的。给出角度、或许是分。求两个卫星之间的圆弧距离和直线弦距离。
需要注意的是圆弧角度大于180就需要转换
code:
while(cin>>s>>a>>opt){
double du=a;
if(opt=="deg") du = a,a=du*PI/180;
else du = a/60.0,a = du*PI/180;
s+=6440;
double hu = a*s;
double juli = sqrt(2*s*s-2*s*s*cos(a));
if(du>180) hu = 2*PI*s-hu;
printf("%.6lf %.6lf\n",hu,juli);
}
B Fourth Point !!
给出平行四边形的三个点,求另一个点。
不会做。看了做法,其实就是不重复的点相加减去重复的点。
code:
int main()
{
//cin.ignore(numeric_limits<streamsize>::max(),'\n');
ios_base::sync_with_stdio(0); cin.tie(0); //cout.tie(0);
Point a,b,c,d;
while(cin>>a.x>>a.y>>b.x>>b.y>>c.x>>c.y>>d.x>>d.y){
if(a==b) swap(b,d);
else if(a==c) swap(c,d);
if(b==c) swap(a,b),swap(c,d);
else if(b==d) swap(a,b);
if(c==d) swap(a,c);
printf("%.3lf %.3lf\n",b.x+c.x-a.x,b.y+c.y-a.y);
}
}
C Is This Integration
给定边长,求各个区域面积。
做法:先找等腰三角,再求等腰三角所在的小扇形。然后用大扇形、小扇形、三角就可以求出边上两个区域相加。
之后直接套关系。
code:
while(cin>>r){ double a=0,b=0,c=0; double shan = PI*r*r/4.0; double xs = 60*PI*r*r/360.0; double sjx = r*r*sqrt(3.0)/4; double x_y = shan-xs-(xs-sjx); a = r*r-shan-x_y; b = r*r-shan-2*a; c = r*r-4*a-4*b; printf("%.3lf %.3lf %.3lf\n",c,b*4,a*4); }