同swustoj 11
Billiard
Time Limit: 1000MS   Memory Limit: 65536K
Total Submissions: 1362   Accepted: 842

Description

In a billiard table with horizontal side a inches and vertical side b inches, a ball is launched from the middle of the table. After s > 0 seconds the ball returns to the point from which it was launched, after having made m bounces off the vertical sides and n bounces off the horizontal sides of the table. Find the launching angle A (measured from the horizontal), which will be between 0 and 90 degrees inclusive, and the initial velocity of the ball. 
Assume that the collisions with a side are elastic (no energy loss), and thus the velocity component of the ball parallel to each side remains unchanged. Also, assume the ball has a radius of zero. Remember that, unlike pool tables, billiard tables have no pockets. 

Input

Input consists of a sequence of lines, each containing five nonnegative integers separated by whitespace. The five numbers are: a, b, s, m, and n, respectively. All numbers are positive integers not greater than 10000. 
Input is terminated by a line containing five zeroes. 

Output

For each input line except the last, output a line containing two real numbers (accurate to two decimal places) separated by a single space. The first number is the measure of the angle A in degrees and the second is the velocity of the ball measured in inches per second, according to the description above.

Sample Input

100 100 1 1 1
200 100 5 3 4
201 132 48 1900 156
0 0 0 0 0

Sample Output

45.00 141.42
33.69 144.22
3.09 7967.81

题意:一个长宽分别为ab的矩形桌子中间有一个球,朝着某个方向以某个速度发射出去,在s时间恰好与水平方向碰撞n次,垂直方向碰撞m次,求发射角度与速度。

#include<iostream>
#include<algorithm>
#include<cstdio>
#include<cmath>
#include<cstring>
using namespace std;
#define INF 0x3f3f3f3f
#define PI acos(-1.0) int main()
{
int n,m;
double a,b,s;
while(scanf("%lf%lf%lf%d%d",&a,&b,&s,&m,&n)!=EOF)
{
if(a+b+s+m+n==) break;
double angel=atan2(b*n,a*m)*/PI;
double v=sqrt(a*a*m*m+b*b*n*n)/s;
printf("%.2f %.2f\n",angel,v);
}
return ;
}

[POJ 2461] Billiard的更多相关文章

  1. hdu 2461(AC) & poj 3695(TLE)(离散化+矩形并)

    Rectangles Time Limit: 5000/4000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  2. POJ题目排序的Java程序

    POJ 排序的思想就是根据选取范围的题目的totalSubmittedNumber和totalAcceptedNumber计算一个avgAcceptRate. 每一道题都有一个value,value ...

  3. POJ 3370. Halloween treats 抽屉原理 / 鸽巢原理

    Halloween treats Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 7644   Accepted: 2798 ...

  4. POJ 2356. Find a multiple 抽屉原理 / 鸽巢原理

    Find a multiple Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7192   Accepted: 3138   ...

  5. POJ 2965. The Pilots Brothers' refrigerator 枚举or爆搜or分治

    The Pilots Brothers' refrigerator Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 22286 ...

  6. POJ 1753. Flip Game 枚举or爆搜+位压缩,或者高斯消元法

    Flip Game Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 37427   Accepted: 16288 Descr ...

  7. POJ 3254. Corn Fields 状态压缩DP (入门级)

    Corn Fields Time Limit: 2000MS   Memory Limit: 65536K Total Submissions: 9806   Accepted: 5185 Descr ...

  8. POJ 2739. Sum of Consecutive Prime Numbers

    Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 20050 ...

  9. POJ 2255. Tree Recovery

    Tree Recovery Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11939   Accepted: 7493 De ...

随机推荐

  1. EXPLAIN PLAN获取SQL语句执行计划

    一.获取SQL语句执行计划的方式 1. 使用explain plan 将执行计划加载到表plan_table,然后查询该表来获取预估的执行计划 2. 启用执行计划跟踪功能,即autotrace功能 3 ...

  2. 选中excel中的对象

    2007在查找和选择中点击“选择对象”,然后再全选全个sheet(ctrl+a)就可以看到了. 2010 “选择对象”在  开始——查找和选择——选择对象

  3. linux内核驱动中_IO, _IOR, _IOW, _IOWR 宏的用法与解析(引用)

    在驱动程序里, ioctl() 函数上传送的变量 cmd 是应用程序用于区别设备驱动程序请求处理内容的值.cmd除了可区别数字外,还包含有助于处理的几种相应信息. cmd的大小为 32位,共分 4 个 ...

  4. [gradle] is applicable for argument types

    error: is applicable for argument types: (org.eclipse.jetty.server.Request) 很显然这个错误是因为 不是静态方法造成的,改为静 ...

  5. iOS开发学习路线图

    很多初学iOS开发的人会经常问:“我想学iOS应该从何入手呢?”.作为一个做了2年多各种iOS开发的程序员,只想写写自己的一些心得体会,好和体验与不好的体验.写的不好,请多包涵.希望能起到抛砖引玉的作 ...

  6. 搭建Git Server

    windows上如何搭建Git Server   Git在版本控制方面,相比与SVN有更多的灵活性,对于开源的项目,我们可以托管到Github上面,非常方便,但是闭源的项目就会收取昂贵的费用.那么私有 ...

  7. 滚珠菜单动效-b

    原型从网上找的,动效使用了CAAnimation和UIDynamic物理引擎.  gitHub  :https://github.com/BearRan/FlowMenuAnimation 大致步骤如 ...

  8. ajax加php实现三级联动

    js代码 <script type="text/javascript">    function get_next(t,pid){  //当前元素的id,当前optio ...

  9. hdu 4722 Good Numbers(规律题)

    http://acm.hdu.edu.cn/showproblem.php?pid=4722 [题意]: 找GoodNumbers一个数N,如果它每一个位数字之和可以整除10,那么它就是GoodNum ...

  10. use sql trigger call java function

    Use UDF sys_exec to do this. You can use this link to use sys_exec function. It says, sys_exec sys_e ...