Ural 1874 Football Goal
来源:互联网 发布:上古历史 知乎 编辑:程序博客网 时间:2024/06/05 21:51
1874. Football Goal
Time limit: 0.5 second
Memory limit: 64 MB
Memory limit: 64 MB
Unlike most students of the Mathematical Department, Sonya is fond of not only programming but also sports. One fine day she went to play football with her friends. Unfortunately, there was no football field anywhere around. There only was a lonely birch tree in a corner of the yard. Sonya searched the closet at her home, found two sticks, and decided to construct a football goal using the sticks and the tree. Of course, the birch would be one of the side posts of the goal. It only remained to make the other post and the crossbar.
Sonya wanted to score as many goals as possible, so she decided to construct a goal of maximum area. She knew that the standard football goal was rectangular, but, being creative, she assumed that her goal could have the form of an arbitrary quadrangle.
You can assume that the birch tree is a segment of a straight line orthogonal to the ground.
Input
The only line contains integers a and b, which are the lengths of the sticks (1 ≤ a, b ≤ 10 000). It is known that the total length of the sticks is less than the height of the birch tree.
Output
Output the maximum area of the goal that can be constructed with the use of the sticks and the birch tree. The answer must be accurate to at least six fractional digits.
Sample
2 2
4.828427125
Problem Author: Fedor Fominykh
Problem Source: Ural Regional School Programming Contest 2011
Problem Source: Ural Regional School Programming Contest 2011
题意:
有一棵无限高的树,还有两个长度为a,b的棍子,用这棵树和一根棍子作为门的两侧门框,另一个棍子作为门的上横梁,求最大门的面积,门为四边形且可以不规则。
嗯,就是这样……
代码:
import java.util.Scanner;public class Main {public static void main(String args[]) {Scanner Cin = new Scanner(System.in);double a = Cin.nextDouble();double b = Cin.nextDouble();double re = (a * a + b * b) / 4.0 + Math.sqrt(2.0) / 2 * a * b;System.out.printf("%.8f\n",re);System.out.println();}}
0 0
- ural 1874 Football Goal
- Ural 1874 Football Goal
- URAL 1874 Football Goal 均值不等式&三分
- timus 1874. Football Goal URAL 解题报告 计算几何
- URAL 1874. Football Goal(数学 浮点数三分)
- 1874. Football Goal
- Football Goal(简单数学题)
- 三分--Football Goal(面积最大)
- URAL 1534 Football in Gondor
- goal
- Football
- Football
- Football
- Football
- Football
- Football
- 计算几何 ural 1874
- URAL
- Android编码规范
- Qt代码段2
- fragment 2
- leetcode笔试题二叉树的前序、中序、后序遍历的递归和循环c++实现
- JS判断设备类型
- Ural 1874 Football Goal
- 近期 Embedding MAP
- Servlet基础知识详解
- ECSHOP模板开发教程完全攻略
- Log4j – 如何配置多个logger?
- ecshop调用指定分类的文章的方法介绍
- iOS-UIViewController的生命周期
- shell--赋值,判断,循环
- Java学习笔记——String类及其常见功能(13)