同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. jQuery实现页内查找相关内容

    当需要在页面中查找某个关键字时,一是可以通过浏览器的查找功能实现,二是可以通过前端脚本准确查找定位,本文介绍通过jQuery实现的页面内容查找定位的功能,并可扩展显示查找后的相关信息. 本文以查找车站 ...

  2. UTF8后MD5

    function ToUTF8Encode(str: string): string; //将字符串转UTF8编码 var b: Byte; begin for b in BytesOf(UTF8En ...

  3. LR中错误代号为27796的解决方法

    问题:   曾经遇到过一个问题,在一次性能测试过程中,使用http协议的多用户向服务器发送请求.设置了持续时间,出现错误为:27796, Failed to connect to server 'ho ...

  4. Django的templates模版

    前面介绍的都是django.http.HttpResponse 把内容直接返回到网页上,这次介绍通过渲染模版的方法来显示内容 步骤: 1.创建一个项目(略) 2.创建一个app(略) 3.添加项目到s ...

  5. python3 pyqt5 和eric5配置教程

    一.大纲内容: 1.预备PC环境: 2.预备安装程序: 2.1.下载Python3.2 2.2.下载PyQt4 2.3.下载Eric5 3.安装配置步骤: 3.1.安装Pyhon3.2 3.2.安装P ...

  6. ASP.NET 页面传值得9种方式

    1. Get(即使用QueryString显式传递)     方式:在url后面跟参数.     特点:简单.方便.     缺点:字符串长度最长为255个字符:数据泄漏在url中.     适用数据 ...

  7. Servlet一次乱码排查后的总结(转)

    原文地址:http://my.oschina.net/looly/blog/287255 由来 在写一个小小的表单提交功能的时候,出现了乱码,很奇怪request上来的参数全部是乱码,而从数据库查询出 ...

  8. 关于android内存泄漏的研究

    博客建了几个月,都没有去写,一是因为当时换工作,然后又是新入职(你懂的,好好表现),比较忙:二是也因为自己没有写博客的习惯了.现在还算是比较稳定了,加上这个迭代基本也快结束了,有点时间来写写博客.好了 ...

  9. 盒模型------CSS

    盒子的内心世界 1.模型 通过CSS的眼睛 在CSS看来,HTML的所有元素都被看成了盒子:段落,标题,块引用,列表,列表项等.甚至内联元素. 盒子的组成 内容区(content):包含内容(文本或图 ...

  10. 《Head First HTML&CSS》笔记

    void元素是指HTML页面中开始标记和结束标记之间没有任何内容的元素. 应当使用相对链接来链接同一网站中的页面,而用URL来链接其他网站上的页面. 浏览器读取计算机本地文件时会使用file协议.文件 ...