Football Goal(简单数学题)

本文介绍了来源于NWPU SRM 2014年的第四题F题,涉及数学和编程知识,主要求解足球进球的最大面积。通过给出的题目描述、输入输出格式和样例输入,作者提供了相应的c++源代码,并进行了问题反思。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

题目来源:[NWPU][2014][SRM][4]  F题

http://vjudge.net/contest/view.action?cid=51335#problem/F



作者:npufz

题目:

F - Football Goal
Time Limit:500MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u

Description

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 ≤  ab ≤ 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 Input

input output
2 2
4.828427125


代码:

#include <iostream>
#include <cmath>
#include <cstdio>
#include <cstdlib>
using namespace std;

int main()
{
    double   a,b;
    cin>>a>>b;
    printf("%.9lf\n",(a*a+b*b)/4.0+sqrt(2)*a*b/2.0);
    return 0;
}

反思:一开始觉得两条边为一个圆的的弦时最大,就开始求角,由于过于着急就错了,后来冷静下来就推出了公式,就A了,但是没有给出证明,相信自己,沉着求解很关键









反思:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值