题目链接:http://acm.tju.edu.cn/toj/showp2917.html
Time Limit: 1.0 Seconds Memory Limit: 65536K
Total Runs: 1120 Accepted Runs: 491
The military academy often employs some of their agents to keep their eyes on the susceptible areas. Suppose MN is the barracks for the soldiers and B, C are two blocks within it. The commander sent two soldiers from block B and C destined to the location A. The two soldiers were going to their destination on the direction ofBA and CA respectively. Both of them were inspecting the areas on their left and right. But when they were reached exactly on the halfway to their destination A, both of them were sent back to the barracks for an emergency need. So, both the soldiers returned to the pavilion on the shortest paths. They made an area of common observation EFPQ i.e. watched by both the soldiers. You have to calculate the side of the common observation area EFQP, if it can be recognized as a square.
Input
You are given the triangular area of AEF. You should keep it in mind that the common area EFQP will not be necessarily become a square always but you can treat this area as an equivalent of a square. E and F are the mid points of AB and AC respectively. Each input will be given in a single line. Input is terminated by a negative number.
Output
You have to calculate the side of the square that is equivalent to the area EFQP. The output should be correct to two decimal places.
Sample input
100 653 2099 -1
Sample output
14.14 36.14 64.79
Problem Setter: Samina Azad (CSE - 03)
Source: CUET individual contest
水题,三角形中位线性质
#include <stdio.h>
#include <cmath>
int main(){
double n;
while(scanf("%lf",&n)&&n>=0)
printf("%.2lf\n",(sqrt(n*2)));
}