Toxophily

Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2555    Accepted Submission(s): 1416

Problem Description
The recreation center of WHU ACM Team has indoor billiards, Ping Pang, chess and bridge, toxophily, deluxe ballrooms KTV rooms, fishing, climbing, and so on.
We all like toxophily.

Bob is hooked on toxophily recently. Assume that Bob is at point (0,0) and he wants to shoot the fruits on a nearby tree. He can adjust the angle to fix the trajectory. Unfortunately, he always fails at that. Can you help him?

Now given the object's coordinates, please calculate the angle between the arrow and x-axis at Bob's point. Assume that g=9.8N/m.

 
Input
The input consists of several test cases. The first line of input consists of an integer T, indicating the number of test cases. Each test case is on a separated line, and it consists three floating point numbers: x, y, v. x and y indicate the coordinate of the fruit. v is the arrow's exit speed.
Technical Specification

1. T ≤ 100.
2. 0 ≤ x, y, v ≤ 10000.

 
Output
For each test case, output the smallest answer rounded to six fractional digits on a separated line.
Output "-1", if there's no possible answer.

Please use radian as unit.

 
Sample Input
3
0.222018 23.901887 121.909183
39.096669 110.210922 20.270030
138.355025 2028.716904 25.079551
 
Sample Output
1.561582
-1
-1
 解题报告:
二分三分什么的好麻烦啊。。。。。。。。。。。。。。。。
直接按照做物理题的思路:

代码如下:

#include<bits/stdc++.h>
using namespace std;
const double PI=3.1415926535898;
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
double x,y,v;
scanf("%lf %lf %lf",&x,&y,&v);
if(x==)//考虑特殊情况
{
if(y==)
printf("0.000000\n");
else
printf("%lf\n",PI/);
continue;
}
double t=x*x-*(4.9)*(x*1.0/v*1.0)*(x*1.0/v*1.0)*(4.9*(x*1.0/v*1.0)*(x*1.0/v*1.0)+y);
if(t>)
{
double r;
if(x>sqrt(t))
{
r=(x-sqrt(t))/(9.8*(x/v)*(x/v));
}else
{
r=(x+sqrt(t))/(9.8*(x/v)*(x/v));
}
printf("%lf\n",atan(r));
}else
{
printf("-1\n");
}
}
}
 
 
 

HDU 2298(纯物理加解一元二次方程)的更多相关文章

  1. java练习题:解一元二次方程、判断闰年、判断标准身材、三个数取最大值

    1.解一元二次方程 注:求根公式为(-b+根号德尔塔)/2a,(-b-根号德尔塔)/2a Scanner sc=new Scanner(System.in); System.out.println(& ...

  2. C语言写解一元二次方程程序心得

    前言:在网上看到不少解一元二次方程的小程序,在使用时总得出一大堆小数,感觉很不爽,遂自己重新写了一遍. 首先,先回忆一下一元二次方程的求根公式: 分别读取二次项.一次项和常数项系数并且求出delta ...

  3. 【Java例题】2.8 解一元二次方程

    8.解一元二次方程. 输入一元二次方程的a,b,c三个系数,解一元二次方程 ax^2+bx+c=0,输出两个根 package study; import java.util.Scanner; pub ...

  4. c语言解一元二次方程

    C语言解一元二次方程,输入系数a,b,c; #include <stdio.h> #include <math.h> int main(int argc, char *argv ...

  5. HDU 2092 (将表达式变成一元二次方程形式)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2092 整数解 Time Limit: 1000/1000 MS (Java/Others)    Me ...

  6. 用c++解一元二次方程

    解方程 github项目地址 这两天得知初二的表妹学了一元二次方程,听说还不会解,我就想着试试用C语言编写解方程. 一元二次方程 用公式法 这种方法效果很好: #include"funct. ...

  7. if语句解一元二次方程~

    #include<stdio.h>#include<math.h> void main(){  double a,b,c,x1,x2;  printf("请输入a&q ...

  8. HDU 5734 Acperience ( 数学公式推导、一元二次方程 )

    题目链接 题意 : 给出 n 维向量 W.要你构造一个 n 维向量 B = ( b1.b2.b3 ..... ) ( bi ∈ { +1, -1 } ) .然后求出对于一个常数 α > 0 使得 ...

  9. 解一元二次方程的C++实现

    一元二次方程的根的情况分为实根与虚根两种,代码如下 #include<iostream> #include<cmath> using namespace std; float ...

随机推荐

  1. border-radius 移动之伤

    border-radius我相信对于老一辈的前端们有着特殊的感情,在经历了没有圆角的蛮荒时代,到如今 CSS3 遍地开花,我们还是很幸福的. 然而即使到了三星大脸流行时代,border-radius在 ...

  2. Git——远程操作详解

    转载自:http://www.ruanyifeng.com/blog/2014/06/git_remote.html 作者: 阮一峰 日期: 2014年6月12日 Git是目前最流行的版本管理系统,学 ...

  3. csv注入漏洞原理&&实战

    前言  为了找工作,巩固巩固知识.本文会介绍 csv 注入漏洞的原理,最后给出一个示例.  正文 在 csv 文件 和 xlsx 文件中的每一项的值如果是 =, @, +, - 就会被 excel 识 ...

  4. Linux kernel pwn notes(内核漏洞利用学习)

    前言 对这段时间学习的 linux 内核中的一些简单的利用技术做一个记录,如有差错,请见谅. 相关的文件 https://gitee.com/hac425/kernel_ctf 相关引用已在文中进行了 ...

  5. vue项目部署上线

    前言 今天把自己写的demo登录写完了,就想着试着走一下部署上线的流程.参考了很多的文档,终于成功进行了部署.在这里将服务器的搭建和vue项目的 部署上线进行整理(都是基础的知识,希望对大家有帮助.对 ...

  6. linux 网络命令last、lastlog、traceroute、netstat

    last /usr/bin/last语法:last功能:列出目前与过去登入系统的用户信息 reboot 是重启信息 lastlog lastlog -u 502(用户ID) traceroute /b ...

  7. 使用jar命令打jar/war包、创建可执行jar包、运行jar包、及批处理脚本编写

    jar 命令 jar 是一个jar.exe可执行命令,即可以生成jar文件,也可以生成war文件   使用示例:jar -cvf ../xxx.jar *  -c   create,创建新的归档文档 ...

  8. centos7 yum安装mysql | mariaDb

    mysql解释: mysql数据库是最常用的一种数据库,下面我来在centos7的迷你版上安装一下mysql.绝对纯净的环境哦 centos:    CentOS-7-x86_64-Minimal-1 ...

  9. OpenLDAP 2.4 禁止匿名用户访问

    ldapmodify -Q -Y EXTERNAL -H ldapi:/// <<EOF dn: cn=config changetype: modify add: olcDisallow ...

  10. selenium模拟鼠标操作

    Selenium提供了一个类ActionChains来处理模拟鼠标事件,如单击.双击.拖动等. 基本语法: class ActionChains(object): """ ...