推公式
1 #include <cstdio> 2 #include <cmath> 3 4 double Cal( double a, double b, double c ) 5 { 6 return a + b - c; 7 } 8 9 int main() 10 { 11 int T; 12 scanf( "%d", &T ); 13 while ( T-- ) 14 { 15 double m[3], n[3], r; 16 scanf( "%lf", &r ); 17 for ( int i = 0; i < 3; ++i ) 18 scanf( "%lf%lf", &m[i], &n[i] ); 19 20 double k[3]; 21 k[0] = 1.0; 22 k[1] = n[1] * ( m[2] + n[2] ) / ( m[2] * ( m[1] + n[1] ) ); 23 k[2] = m[1] * ( m[0] + n[0] ) / ( n[0] * ( m[1] + n[1] ) ); 24 25 double a = sqrt( 4.0*(k[0]+k[1]+k[2])*r*r / ( Cal(k[1], k[2], k[0])*Cal(k[0], k[2], k[1])*Cal(k[0], k[1], k[2]) ) ); 26 double b = k[1] * a; 27 double c = k[2] * a; 28 double ans = ( a + b + c ) * r / 2.0; 29 printf( "%.4f ", ans ); 30 } 31 return 0; 32 }