[LightOJ] [1043] Triangle Partitioning

Problem Description

Loading...

Problem Analysis

The ratio of the areas of similar triangles is the square of the similarity ratio
From the given ratio we can obtain the area ratio of the triangles
and then the similarity ratio
so as to obtain the length of AD

cpp
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#include<stdio.h>
#include<math.h>
int main() {
	int T,kase=0;
	scanf("%d",&T);
	while(T--) {
		double a,b,c,d;
		scanf("%lf %lf %lf %lf",&a,&b,&c,&d);
		printf("Case %d: %lf\n",++kase,a*sqrt(d/(d+1)));
	}
	return 0;
}

Problem link: LightOJ 1043 Triangle Partitioning

This post is licensed under CC BY-NC-SA 4.0. If it helped, or if you have anything to say, the comment box below is open.
Page views —
Unique visitors —

Loading...