BUPT2017 wintertraining(15) #4F
Gym - 101124A

题意

给定画框宽度,画的四边和一个对角线长度,求画框外沿周长。

题解

过顶点做画框的垂线,每个角都得到两个全等直角三角形。然后用余弦公式求得四个角,再在直角三角形中计算出比内沿多出来的长度,加上画的四边长度即可。

代码

#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
double a,b,c,d,e,h;
double get(double t){
	return h/tan(t/2)*2;
}
double getc(double a,double b,double c){
	return acos((a*a+b*b-c*c)/2/a/b);
}
int main() {
	scanf("%lf%lf%lf%lf%lf%lf",&h,&a,&b,&c,&d,&e);
	printf("%.3f",a+b+c+d+get(getc(d,e,c)+getc(a,e,b))+get(getc(c,e,d)+getc(b,e,a))+get(getc(d,c,e))+get(getc(a,b,e)));
	return 0;
}

相关文章:

  • 2021-09-12
  • 2021-07-17
  • 2022-12-23
  • 2021-08-08
  • 2021-10-04
  • 2021-05-27
  • 2021-08-22
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-07-05
  • 2022-12-23
  • 2022-12-23
  • 2021-07-26
  • 2022-01-21
  • 2021-11-02
相关资源
相似解决方案