题意不难理解,仔细看题吧,就不说题意了

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std; const double PI=acos(-1.0);
const double g=9.8; double V[205]; int main()
{
//freopen("in.txt","r",stdin);
int n;
while(scanf("%d",&n),n)
{
double H,L1,R1,L2,R2;
memset(V,0,sizeof(V));
scanf("%lf%lf%lf%lf%lf",&H,&L1,&R1,&L2,&R2);
for(int i=0; i<n; i++)
scanf("%lf",&V[i]);
if(L2<=L1 && R2>=R1)
printf("0\n");
else
{
int ans=0;
double add=PI/1000; //一开始我是另add=0.001,虽然比PI/1000还小,然而无限wa。可能是样例所要求弧度是PI平均分割的,0.001精读比PI/1000小,例如(没验证),0.003不能打到敌方,而0.00314159....可以,但是0.004也不能打到敌方。
for(double i=-PI/2; i<PI/2; i+=add)
{
int cou=0;
for(int j=0;j<n;j++)
{
double Vx0=V[j]*cos(i);
double Vy0=V[j]*sin(i);
double Vy=sqrt(2*g*H+Vy0*Vy0);
double t=(Vy-Vy0)/g;
double x=Vx0*t;
if(x>=L2 && x<=R2)
{
cou=0;
break;
}
if(x>=L1 && x<=R1)
cou++;
}
ans=ans>cou? ans:cou;
}
printf("%d\n",ans);
}
}
return 0;
}

最新文章

  1. Android仿“守望先锋”加载动画
  2. 最新版CocoaPods的使用与安装-以导入ReactiveCocoa框架为例
  3. ERROR 1130 (HY000) Host ‘hostname’ is not allowed to connect to this MySQL server
  4. 无废话ExtJs 入门教程十一[下拉列表:Combobox]
  5. Windows上一步一步CoreRun
  6. Java基础之创建窗口——使用流布局管理器(TryFlowLayout)
  7. Python 基础教程中的问题及解决方案(1)
  8. Schedule Problem spfa 差分约束
  9. Kotlin 类和对象
  10. 【洛谷P4145】花神游历各国
  11. jstat命令详解
  12. 指向字符串的指针和char类型的数组
  13. python binascii模块详解
  14. Python 爬虫-BeautifulSoup
  15. Drupal的目录结构
  16. linux下如何退出tmux和重新进入tmux
  17. Java Float类型 减法运算时精度丢失问题
  18. Laravel之Ueditor
  19. unity, water cube
  20. shell进阶教程

热门文章

  1. Windows10查看电脑的USB接口是2.0还是3.0
  2. kvm虚拟机迁移(6)
  3. SpringMVC MVC 架构模式
  4. 1.2Linux 主要目录速查表
  5. Centos7.4永久修改系统时间
  6. window location href is not a function(Day_36)
  7. java 文件上传下载
  8. PDF 文件编写器 C# 类库(版本 1.28.0)使用详解
  9. 1. 回顾Servlet
  10. CVPR2020论文点评: AdderNet(加法网络)