angry_birds_again_and_again
来源:互联网 发布:查找算法. 编辑:程序博客网 时间:2024/06/03 18:16
题目描述
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 lineO-Tappingposition-Pig-O)
输入
The first line contains only one integerT (T is about1000) indicates the number of test cases. For each case there are two integers,pxtx, and a float numberα.(0 < Tx ≤ Px ≤ 1000,0 < α < π/2) .
输出
One line for each case specifying the distance rounded to three digits.
样例输入
12 1 1.0
样例输出
0.692
//题意:求由实线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+bs=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)*/
- angry_birds_again_and_again
- angry_birds_again_and_again SD5THACM
- SDUT 2877:angry_birds_again_and_again
- 2014山东省第五届ACM省赛 angry_birds_again_and_again
- 2014年山东省第五届ACM--angry_birds_again_and_again
- 第五届ACM大学生程序设计竞赛:angry_birds_again_and_again
- 第五届山东省ACM angry_birds_again_and_again(积分)
- 2014山东省第五届ACM省赛 angry_birds_again_and_again
- [ACM] sdut 2877 angry_birds_again_and_again (简单数学积分)
- 山东省第五届ACM大学生程序设计竞赛-angry_birds_again_and_again(积分)
- 山东省第五届ACM大学生程序设计竞赛 angry_birds_again_and_again 求积分
- 2014年山东ACM第五届省赛 angry_birds_again_and_again(数学积分)
- 山东省第五届ACM省赛题——angry_birds_again_and_again(计算几何)
- LeetCode: Palindrome Partitioning
- sed 用法
- 什么叫暖男?
- 实现京东的城市切换功能
- C/C++堆栈指引
- angry_birds_again_and_again
- 单页站优化六个绝招
- 只有程序员才能破解的密码
- jenkins+ant配置自动化任务全过程
- Android源码下载
- 利用indent格式化源文件的脚本
- 横向表格
- 【线段树】-POJ-3468-区间增减&区间求和
- Django记-模版与静态文件(js/css/image)