标签:des style blog http color os io ar strong
给一个三角形,画出它的内接圆,然后圆与三角形的边会有交点,这些点分别把每条边分成两部分,这两部分的比例也分别给出,
内接圆的半径也知道,求三角形面积。
我的做法:
用海伦公式与半径,给出的比例,用三角形内心的性质及其三角形的面积联立方程
我的代码:
#include<iostream> #include<map> #include<string> #include<cstring> #include<cstdio> #include<cstdlib> #include<cmath> #include<queue> #include<vector> #include<algorithm> using namespace std; int main() { int N; double s,a,b,c,r,n[10],m[10],x; cin>>N; while(N--) { cin>>r>>m[1]>>n[1]>>m[2]>>n[2]>>m[3]>>n[3]; a=m[1]+n[1]; b=n[1]+n[1]*n[2]/m[2]; c=m[1]+m[1]*m[3]/n[3]; x=2*r*sqrt((a+b+c)/(b+c-a)/(a+c-b)/(a+b-c)); s=(a+b+c)*x*r/2; printf("%.4lf\n",s); } }
Problem E
In-Circle
Input: Standard Input
Output: Standard Output
In-circle of a triangle is the circlethat touches all the three sides of the triangle internally. The center of thein-circle of a triangle happens to be the common intersection point of thethree bisectors of the internal angles. In this problem you will not be askedto find the in-circle of a triangle, but will be asked to do the opposite!!
First line of the input filecontains an integer N (0<N<50001), which denotes how many input sets areto follow. The description of each set is given below.
Each set consists of four lines.The first line contains a floating-point number r (1<r<5000), whichdenotes the radius of the in-circle. Each of the next three lines contains two floating-pointnumbers, which denote the values of m1, n1, m2,n2, m3 and n3 (1<m1, n1,m2, n2, m3, n3<50000)respectively.
For each set ofinput produce one line of output. This line contains a floating-point numberthat denotes the area of the triangle ABC. This floating-point number shouldcontain four digits after the decimal point. Errors less than 5*10-3will be ignored. Use double-precision floating-point number for calculation.
2 140.9500536497 15.3010457320 550.3704847907 464.9681681852 65.9737378230 55.0132446384 10.7791711946 208.2835101182 145.7725891419 8.8264176452 7.6610997600 436.1911036207 483.6031801012 140.2797089713 |
400156.4075 908824.1322 |
Problemsetter: Shahriar Manzoor
Special Thanks: Mohammad Mahmudur Rahman标签:des style blog http color os io ar strong
原文地址:http://blog.csdn.net/stl112514/article/details/39160391