TOJ 2353: Billiard
数学?计算几何?物理?这个还是很轻松的。
353: Billiard 
Total Submit: 9 Accepted:4
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
Source
horizontal这个单词我还迷了一会,原来就是给你一个长a宽b的台球桌,桌子正中心有一个球,和水平方向以某个夹角,某个速度打出,在s秒后回到原来位置并且和水平方向撞了m次,垂直方向撞了n次
问那你这个夹角和速度
所以转化为物理(数学)问题
你可以把他的路径拼成一条直线,这样明显就知道直角三角形的两条边了
求速度呢,这个也简单,你算一下走过的距离好了,水平方向走了多少,竖直方向走了多少,距离就是斜边长度啊,还有时间s,所以这个题就是个简单数学问题了
#include<stdio.h>
#include<math.h>
const double PI=acos(-.);
int main()
{
double a,b,s,m,n;
while(~scanf("%lf%lf%lf%lf%lf",&a,&b,&s,&m,&n),a||b||s||m||n)
printf("%.2f %.2f\n",atan(b*n/a/m)*/PI,sqrt(b*b*n*n+a*a*m*m)/s);
return ;
}
另附上一道天梯赛和这个一样好玩的
L3-1. 非常弹的球
刚上高一的森森为了学好物理,买了一个“非常弹”的球。虽然说是非常弹的球,其实也就是一般的弹力球而已。森森玩了一会儿弹力球后突然想到,假如他在地上用力弹球,球最远能弹到多远去呢?他不太会,你能帮他解决吗?当然为了刚学习物理的森森,我们对环境做一些简化:
•假设森森是一个质点,以森森为原点设立坐标轴,则森森位于(0, 0)点。
•小球质量为w/100 千克(kg),重力加速度为9.8米/秒平方(m/s2)。
•森森在地上用力弹球的过程可简化为球从(0, 0)点以某个森森选择的角度ang (0 < ang < pi/2) 向第一象限抛出,抛出时假设动能为1000 焦耳(J)。
•小球在空中仅受重力作用,球纵坐标为0时可视作落地,落地时损失p%动能并反弹。
•地面可视为刚体,忽略小球形状、空气阻力及摩擦阻力等。
森森为你准备的公式:
动能公式:E = m * v^2 / 2
牛顿力学公式:F = m * a
重力:G = m * g
其中:
E - 动能,单位为“焦耳”
m - 质量,单位为“千克”
v - 速度,单位为“米/秒”
a - 加速度,单位为“米/秒平方”
g - 重力加速度
输入格式:
输入在一行中给出两个整数:1 <= w <= 1000 和 1 <= p <= 100,分别表示放大100倍的小球质量、以及损失动力的百分比p。
输出格式:
在一行输出最远的投掷距离,保留3位小数。
输入样例:100 90
输出样例:226.757
简单推一下,v^2=2E/m
s=vt=2vcosθ/g*vsinθ=v^2sin2θ/g
sin2θ最大值是1,也就是θ为45°
#include<stdio.h>
#include<cmath>
int main()
{
double w,p,e;
scanf("%lf%lf",&w,&p);
e=*/w;
p=-p/;
double s=;
while(e>0.000001)
{
s+=e/9.8;
e=e*p;
}
printf("%.3f",s);
return ;
}
TOJ 2353: Billiard的更多相关文章
- TOJ 2776 CD Making
TOJ 2776题目链接http://acm.tju.edu.cn/toj/showp2776.html 这题其实就是考虑的周全性... 贡献了好几次WA, 后来想了半天才知道哪里有遗漏.最大的问题 ...
- [POJ 2461] Billiard
同swustoj 11 Billiard Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1362 Accepted: 8 ...
- TOJ 1702.A Knight's Journey
2015-06-05 问题简述: 有一个 p*q 的棋盘,一个骑士(就是中国象棋里的马)想要走完所有的格子,棋盘横向是 A...Z(其中A开始 p 个),纵向是 1...q. 原题链接:http:// ...
- TOJ 1139.Compromise
2015-06-03 问题简述: 大概就是输入两段文本(用小写英文字母表示),分别用#表示一段话的结束输入,输出这两个文本的最长公共子序列. 简单的LCS问题,但是输入的是一段话了,而且公共部分比较是 ...
- 优先队列运用 TOJ 4123 Job Scheduling
链接:http://acm.tju.edu.cn/toj/showp4123.html 4123. Job Scheduling Time Limit: 1.0 Seconds Memory ...
- 最小生成树 TOJ 4117 Happy tree friends
链接http://acm.tju.edu.cn/toj/showp4117.html 4117. Happy tree friends Time Limit: 1.0 Seconds Memo ...
- TOJ 4120 Zombies VS Plants
链接:http://acm.tju.edu.cn/toj/showp4120.html 4120. Zombies VS Plants Time Limit: 1.0 Seconds Memo ...
- Codeforces Codeforces Round #484 (Div. 2) E. Billiard
Codeforces Codeforces Round #484 (Div. 2) E. Billiard 题目连接: http://codeforces.com/contest/982/proble ...
- Codeforces 982E Billiard exgcd
Billiard 枚举终点, 对于每一个终点一共有四种周期的相遇方式, 枚举一下取最小的时间. #include<bits/stdc++.h> #define LL long long # ...
随机推荐
- slf4j介绍以及与Log4j、Log4j2、LogBack整合方法
翻了一下百度和官网.这么介绍slf4j. slf4j 全称 Simple Logging Facade for Java,是日志框架的一种抽象,那么也就是说 slf4j 是不能单独使用的必须要有其他实 ...
- 【原创】微信公众号与HTML 5混合模式揭秘4——jssdk调用微信扫一扫
微信公众号与HTML 5混合模式揭秘1——如何部署JSSDK 微信公众号与HTML 5混合模式揭秘2——分享手机相册中照片 微信公众号与HTML 5混合模式揭秘3——JSSDK获取地理位置 在JS ...
- Android Theme.Dialog 到光 AppCompatDialog
我用在我的 style.xml 作为主要应用程序主题 <style name="AppTheme" parent="Theme.AppCompat.Light&qu ...
- apache安装报错
libtool: install: error: cannot install `libaprutil-1.la' to a directory not ending /some_directory ...
- 洛谷 P1334 瑞瑞的木板==P2664 【题目待添加】
题目描述 瑞瑞想要亲自修复在他的一个小牧场周围的围栏.他测量栅栏并发现他需要N(1≤N≤20,000)根木板,每根的长度为整数Li(1≤Li≤50,000).于是,他神奇地买了一根足够长的木板,长度为 ...
- (一)SpringMVC之警告: No mapping found for HTTP request with URI
这个警告往往是因为url路径不正确. 所以从三个地方下手: 1.springmvc-config.xml中的配置handle,看看是不是因为handle没有配置导致的. 2.如果是使用注解的方式的话, ...
- HtmlUnit爬取Ajax动态生成的网页以及自动调用页面javascript函数
HtmlUnit官网的介绍: HtmlUnit是一款基于Java的没有图形界面的浏览器程序.它模仿HTML document并且提供API让开发人员像是在一个正常的浏览器上操作一样,获取网页内容,填充 ...
- 2012-2013 ACM-ICPC, NEERC, Central Subregional Contest C Sequence (打表)
打个表找找规律,到24445的时候乘2以后产生了0出现循环. 一般地,判断循环节是否存在可以用Floyd判圈算法. #include<bits/stdc++.h> using namesp ...
- 与调试器共舞 - LLDB 的华尔兹
你是否曾经苦恼于理解你的代码,而去尝试打印一个变量的值? 1 NSLog(@"%@", whatIsInsideThisThing); 或者跳过一个函数调用来简化程序的行为? 1 ...
- 文本编辑器vim/vi用法完全解读
vi用法 1.启动vim 2.命令模式和输入模式 3.退出vi 4.vi与ex命令 5.移动光标 6.跳转 7.搜索 8.插入文本 9.修改文本 10.替换文本 11.删除文本 12.恢复和撤销改变 ...