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)+(/3.0*t*tx*tx*tx+0.5*tan(a)*tx*tx);
printf("%.3lf\n",sum);
}
return ;
}

简单数学题,大神的思路

//题意:求由实线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*(*p-*t);
t2=*(*p-t);
printf("%.3lf\n",t1/t2*tan(a));
}
return ;
}
/*由题意可设抛物线方程为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)*/

最新文章

  1. 电容与EMC-电容不同功能时对整板EMC的作用
  2. (转)学习使用Jmeter做压力测试(三)--数据库测试
  3. spring知识大全(3)
  4. [算法导论]DFS @ Python
  5. [SQL]获取所有数据库名、获取数据库中表名、获取表中的字段名
  6. zoj 3716 Ribbon Gymnastics (思维数学题)
  7. Java自动装箱和自动拆箱操作
  8. c# 字符串编码问题
  9. mysql dump 参数
  10. [leetcode-553-Optimal Division]
  11. SQL 添加索引
  12. python学习笔记(四)- 常用的字符串的方法
  13. 如何创建和还原SQL Server 2000数据库?
  14. EXPLAIN执行计划中要重点关注哪些要素(叶金荣)
  15. 虚拟机安装centos7
  16. 基于jQuery环形图标菜单旋转切换特效
  17. 【JavaScript 从零开始】变量作用域
  18. Web开发者的福利 30段超实用CSS代码
  19. 运行TensorFlow报错,“This program requires version 3.6.1 of the Protocol Buffer runtime library, but the installed version is 3.0.0.”
  20. Watchbog挖矿病毒程序排查过程

热门文章

  1. tiny4412 ubuntudesktop更新源(old)
  2. DM8168 PWM驱动与測试程序
  3. day10&lt;面向对象+&gt;
  4. HTML表单的应用
  5. css图片宽高相等设置
  6. 前端 ui 框架
  7. Python 流程控制:while
  8. 《C++ Primer Plus》第7章 函数——C++的编程模块 学习笔记
  9. PyQt4重写事件处理方法
  10. 【java】将List中的实体按照某个字段进行分组的算法