山东省第五届省赛 A题 angry_birds_again_and_again(简单数学 积分问题)

Description
The problems called “Angry Birds” and “Angry Birds Again and Again” has been solved by many teams in the series of contest in 2011 Multi-University Training Contest.

This time we focus on the yellow bird called Chuck. Chuck can pick up speed and distance when tapped.

You can assume that before tapped, Chuck flies along the parabola. When tapped, it changes to fly along the tangent line. The Chuck starts at the coordinates (0, 0). Now you are given the coordinates of the pig (Px, 0), the x-coordinate of the tapping position (Tx) and the initial flying angle of Chuck (α).
这里写图片描述

∠AOx = α
Please calculate the area surrounded by Chuck’s path and the ground.(The area surrounded by the solid line O-Tapping position-Pig-O)
Input
The first line contains only one integer T (T is about 1000) indicates the number of test cases. For each case there are two integers, px tx, and a float number α.(0 < Tx ≤ Px ≤ 1000, 0 < α <  ) .
Output
One line for each case specifying the distance rounded to three digits.
Sample Input
1
2 1 1.0
Sample Output
0.692

**【题意】:**就是给你一个经过(0,0)点的一个二次曲线 在给你一个tx,px,角A,问你在tx点二次曲线和切线还有x轴正半轴围成的曲线。
**【思路】:**求出二次曲线的表达式然后定积分求面积即可。

设二次曲线的表达式为 y=axx+b*x+c;
因为其过(0,0)点所以 c=0;

方程两边求导 y’=2ax+b
在(0,0)点的倒数为 b 用因为角AOX=角A 所以 b=tan(角A);

接下来仅需要求a即可:利用RT三角形TPD(设从TX点做垂直与x轴正半轴的直线与二次曲线的交点为D)
绝对值 tan(角DPT)=AT/PT;(注意这里的斜率是负的所以加绝对值)

推出来 -2at-b=(att+bt)/(p-t);
令c=p-t; 偷懒方便书写
a=(-b
c-bt)/(tt+2tc);

最后直接求面积即可 总面积=定积分求二次曲线面积+三角形DPT面积

S=(a/3)ttt+(b/t)tt+0.5(att+b*t)*c。

【代码】:

#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <string>

using namespace std;
const int N=5e5+10;

//设给你的二次函数的解析式为y=a*x*x+b*x+c
//然后输入的 p为px t为Tx jiao为角AOX的大小

int main()
{
    int T;
    cin>>T;
    while(T--)
    {
        double ans=0,a=0,b=0,jiao=0,p,t,c;
        cin>>p>>t>>jiao;
        c=p-t;
        b=tan(jiao);
        a=1.0*(-b*c-b*t)/(t*t+2*t*c);
        ans=(1.0/3.0)*t*t*t*a+0.5*b*t*t+0.5*(a*t*t+b*t)*c;
       printf("%.3lf\n",ans);

    }
    return 0;
}
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值