标签:style blog class code c tar
题意:如图已知AB,AC,BC,和SADE与SDECB的比r,求AD的长。
解题思路:由于SADE/SABC=(AD/AB)^2;
令p=SADE ,q=SDECB;
p/(p+q)=(AD/AB)^2;
1/(1+q/p)=(AD/AB)^2;
所以AD=AB*sqrt(1/(1+1/r);
1 //Accepted 1100 KB 0 ms 2 #include <cstdio> 3 #include <cstring> 4 #include <cmath> 5 double ab,ac,bc,p; 6 double slove() 7 { 8 p=1/(1+1/p); 9 return ab*sqrt(p); 10 } 11 int main() 12 { 13 int T; 14 scanf("%d",&T); 15 for (int t=1;t<=T;t++) 16 { 17 scanf("%lf%lf%lf%lf",&ab,&ac,&bc,&p); 18 printf("Case %d: %.9lf\n",t,slove()); 19 } 20 return 0; 21 }
lightoj1043Triangle Partitioning,布布扣,bubuko.com
lightoj1043Triangle Partitioning
标签:style blog class code c tar
原文地址:http://www.cnblogs.com/djingjing/p/3734519.html