题目链接:http://acm.tju.edu.cn/toj/showp1320.html

1320.   Billiard


Time Limit: 1.0 Seconds   Memory Limit: 65536K
Total Runs: 315   Accepted Runs: 213    Multiple test files


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: absm, 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

Source: Waterloo Local Contest Jun. 19, 1999


Submit   List    Runs   Forum   Statistics

反射问题,其实就是球在水平方向位移为a*m,竖直方向位移为b*n,用时为t,所以初始运动方向为ans=atan(1.0*sy/sx); 初速度为:v=(1.0*sy/s)/sin(ans);

#include <stdio.h>
#include <cmath>
int main(){int a,b,s,m,n;int sx,sy;double ans,v;while(~scanf("%d%d%d%d%d",&a,&b,&s,&m,&n)&&(a||b||s||m||n)){sx=a*m;sy=b*n;ans=atan(1.0*sy/sx);v=(1.0*sy/s)/sin(ans);printf("%.2lf %.2lf\n",ans*180/(acos(-1)),v);}
}

TOJ 1320.Billiard相关推荐

  1. TOJ 2353: Billiard

    数学?计算几何?物理?这个还是很轻松的. 353: Billiard  Time Limit(Common/Java):1000MS/10000MS     Memory Limit:65536KBy ...

  2. TOJ 1702.A Knight's Journey

    2015-06-05 问题简述: 有一个 p*q 的棋盘,一个骑士(就是中国象棋里的马)想要走完所有的格子,棋盘横向是 A...Z(其中A开始 p 个),纵向是 1...q. 原题链接:http:// ...

  3. 数集合有多少个TOJ(2469)

    题目链接:http://acm.tju.edu.cn/toj/showp2469.html 感觉这个题目有点问题,算了不管他了,反正A了. 这里要注意的是求这个集合有多少种,那么就是要剔除重复数后,再 ...

  4. 信息学奥赛一本通(1320:【例6.2】均分纸牌(Noip2002))

    1320:[例6.2]均分纸牌(Noip2002) 时间限制: 1000 ms         内存限制: 65536 KB 提交数: 12714     通过数: 6841 [题目描述] 有n堆纸牌 ...

  5. toj 4604 搞笑版费马大定理

    toj 4604 搞笑版费马大定理 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte 总提交: 122 测试通过:67 描述 费马大定理:当n>2时,不定方 ...

  6. toj 4601 好老师

    toj 4601 好老师 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte 总提交: 73 测试通过:37 描述 我想当一个好老师,所以我决定记住所有学生的名字. ...

  7. toj 4597 字符识别?

    toj 4597 字符识别? 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte 总提交: 122 测试通过:95 PS:最好是看原题,这里图案对齐不是那么好. 4 ...

  8. toj 4596 一行盒子

    toj 4596 一行盒子 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte 总提交: 116 测试通过:11 描述 你有一行盒子,从左到右依次编号为1, 2, ...

  9. toj 4319 盒子游戏

    toj 4319 盒子游戏 时间限制(普通/Java):1000MS/3000MS 内存限制:65536KByte 总提交: 137 测试通过:76 描述 有两个相同的盒子,其中一个装了 n 个球,另 ...

最新文章

  1. java动物园管理员_zookeeper动物园管理员学习笔记
  2. 万维网源代码正在被发明人拍卖,有人出价1800万,还在不断上涨
  3. javascript精要(3)-动态加载脚本
  4. HTML与JS交换值
  5. 【机器视觉】 exit算子
  6. 今日早上出来还是阴天
  7. Android自定义view之ViewPager指示器——2
  8. 电视盒子_刷机固件_免费合集分享
  9. C语言股票交易软件,甩手掌柜股票自动交易程序(2021年5月版)
  10. postman安装html插件安装,Postman 安装与更新
  11. 5部靠身材和脸蛋撑起了整部电影,女主光环太刺眼,部部是经典!
  12. markdown详细安装教程
  13. 【小y设计】二维码条形码打印编辑器
  14. ios 区分iphone ipod ipad的方法及获取设备名称。
  15. Linux系统/etc/resolv.conf文件为只读模式,且无法更改权限
  16. 儿子作恶,母亲受报应
  17. word文档图标变成白纸_Word图标变成白框加WORD图标的解决方案
  18. Logisticregression学习
  19. 基于ssm老街坊网站、购物网站的实现与设计mysql
  20. MATLAB的rename命令应用,rename命令怎么使用

热门文章

  1. 囚徒困境(条件判断)
  2. 计算机的信息安全教学反思,信息安全 教学设计 教学反思.doc
  3. category ue 协议_LTE中UE能力(UE Capability)的梳理和解析
  4. Tushare取数-历史行情/实时行情
  5. u盘乱码怎么办?数据丢失如何恢复?(详解)
  6. github self-hosted runner 添加与启动
  7. 东北大学计算机考研专业842包括什么,2020年东北大学842《计算机专业基础》考研大纲...
  8. 去掉word页眉上横线的技巧
  9. LINUX基础CAN指令及常见操作
  10. Win10输入法无法选择,右下角出现叉号,提示IME被禁用