angry_birds_again_and_again(2014年山东省第五届ACM大学生程序设计竞赛A题)

http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2877

题目描述

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)

输入

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 < α <  ) .

输出

One line for each case specifying the distance rounded to three digits.

示例输入

1
2 1 1.0

示例输出

0.692

提示

数学知识学得很不扎实,很大程度程度上是在应付考试,导致不会灵活运用,在高中这种题手到擒来,但现在感觉做的有点费事。

来源

2014年山东省第五届ACM大学生程序设计竞赛

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

int main()
{
    int T;
    double px,tx,t,ty,sum,a;
    cin>>T;
    while(T--)
    {
        cin>>px>>tx>>a;
        t=(tan(a)*px)/(tx*tx-2.0*tx*px);
        ty=t*tx*tx+tx*tan(a);
        sum=(0.5*(px-tx)*ty)+(1/3.0*t*tx*tx*tx+0.5*tan(a)*tx*tx);
        printf("%.3lf\n",sum);
    }
    return 0;
}

简单数学题,大神的思路

//题意:求由实线O-Tappingposition-Pig-O所围成图形的面积 s.

#include<stdio.h>
#include<math.h>
int main()
{
    int n;
    scanf("%d",&n);
    while(n--)
    {
        int t,p;
        double a,t1,t2;
        scanf("%d%d%lf",&p,&t,&a);
        t1=p*t*(3*p-2*t);
        t2=6*(2*p-t);
        printf("%.3lf\n",t1/t2*tan(a));
    }
    return 0;
}
/*由题意可设抛物线方程为f(x)=a*x^2+b*x ,Tap点的纵坐标为 y,
由O-Tappingposition-Tx-O所围成图形的面积为 s1,
由Tx-Tappingposition-pig-Tx所围成图形的面积为s2.
f‘(x)=2*a*x+b
s=s1+s2  ...... (1)
s2=1/2*(px-tx)*y  ...... (2)
s1=1/3*a*tx^3+1/2*b*tx^2  ...... (3)
f‘(0)=tan(a) => b=tan(a)  ...... (4)
f(tx)=y => a*tx^2+b*tx=y  ...... (5)
f‘(tx)=-y/(px-tx) => 2*a*tx+b=-y/(px-tx)  ...... (6)
联立(1)(2)(3)(4)(5)(6)解得:s=[px*tx*(3*px-2*tx)]/[6*(2*px-tx)]*tan(a)*/
时间: 10-31

angry_birds_again_and_again(2014年山东省第五届ACM大学生程序设计竞赛A题)的相关文章

2014年山东省第五届ACM大学生程序设计竞赛解题报告

A  angry_birds_again_and_again http://www.sdutacm.org/sdutoj/problem.php?action=showproblem&problemid=2877 数学题,求抛物线和直线围成的面积,用积分来做. 设方程 y=ax^2+bx+c ,图中曲线经过原点,所以c=0. 对方程求导 y'=2ax+b ,  y'代表斜率,那么原点(0,0)这一点,代人y'=b,即该点的斜率,根据题意b=tan( α) 如图:在题目中x=tx这一点时,容易混,

[2012山东省第三届ACM大学生程序设计竞赛]——Fruit Ninja II

Fruit Ninja II 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2416 Time Limit: 5000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描述 Have you ever played a popular game named "Fruit Ninja"? Fruit Ninja (known as Fruit Ninja

Alice and Bob(2013年山东省第四届ACM大学生程序设计竞赛)

Alice and Bob Time Limit: 1000ms   Memory limit: 65536K 题目描述 Alice and Bob like playing games very much.Today, they introduce a new game. There is a polynomial like this: (a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*.......*(an-1 * x^(2^(n-1))+1). Then Alice as

sdut Mountain Subsequences 2013年山东省第四届ACM大学生程序设计竞赛

Mountain Subsequences 题目描述 Coco is a beautiful ACMer girl living in a very beautiful mountain. There are many trees and flowers on the mountain, and there are many animals and birds also. Coco like the mountain so much that she now name some letter s

[2012山东省第三届ACM大学生程序设计竞赛]——n a^o7 !

n a^o7 ! 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2413 Time Limit: 1000MS Memory limit: 65536K 题目描述 All brave and intelligent fighters, next you will step into a distinctive battleground which is full of sweet and hap

[2013山东省第四届ACM大学生程序设计竞赛]——Alice and Bob

Alice and Bob Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Alice and Bob like playing games very much.Today, they introduce a new game. There is a polynomial like this: (a0*x^(2^0)+1) * (a1 * x^(2^1)+1)*.......*(an-1 * x^(2^(n-1))+1). T

[2012山东省第三届ACM大学生程序设计竞赛]——Mine Number

Mine Number 题目:http://acm.sdut.edu.cn/sdutoj/problem.php? action=showproblem&problemid=2410 Time Limit: 1000ms Memory limit: 65536K 有疑问?点这里^_^ 题目描写叙述 Every one once played the game called Mine Sweeping, here I change the rule. You are given an n*m ma

[2013山东省第四届ACM大学生程序设计竞赛]——Rescue The Princess

Rescue The Princess Time Limit: 1000ms   Memory limit: 65536K  有疑问?点这里^_^ 题目描述 Several days ago, a beast caught a beautiful princess and the princess was put in prison. To rescue the princess, a prince who wanted to marry the princess set out immedia

ZZUOJ-1195-(郑州大学第七届ACM大学生程序设计竞赛E题)

1195: OS Job Scheduling Time Limit: 2 Sec  Memory Limit: 128 MB Submit: 106  Solved: 35 [Submit][Status][Web Board] Description OS(Operating System) is to help user solve the problem, such as run job(task).A multitasking OS is one that can simultaneo