Elastic Ball in the Frame(水题)
来源:互联网 发布:cpda数据分析师 含金量 编辑:程序博客网 时间:2024/05/16 09:35
1463: Elastic Ball in the Frame
Time Limit: 2 Sec Memory Limit: 128 MBSubmit: 249 Solved: 72
[Submit][Status][Web Board]
Description
In a rectangular frame, there’s an elastic ball which can be regarded as a mass point(The ball can make elastic collisions with the frame).The frame lies on a smooth horizontal plane, and the initial position of the ball is at the lower left quarter(左下角)of the frame. Taking horizontal border as x axis and the vertical border as y axis, we can build the coordinate(坐标系). The position of the ball is (0,0).Given the ball’s initial speed, you are supposed to find its position at time t. (The collision trace of the ball forms a mirror reflection.)
Input
There is a positive integer n(n<1000) on the first line, representing the case number. There follows n lines, each line has 5 positive rational number, v(0<v<100), a(0<a<90), l(0<l<100), d(0<d<100),t(0<t<107),representing the ball’s initial speed, the intersection angle between the ball’s initial speed and the x axis, the length of the vertical border, the length of the horizontal border, and the queried time respectively.
Output
For each case, output the corresponding position in the (x,y) form, keeping two decimal places.
Sample Input
21 45 2 2 21 53.13 4 6 10
Sample Output
(1.41,1.41)(6.00,0.00)
HINT
Sample 1 and sample 2 are shown below.
题意:在矩形框架中,有一个弹性球可以被认为是一个质点(球可以与框架弹性碰撞)。框架位于平滑的水平面上,球的初始位置在左下方(左下角)。将水平边框作为x轴和垂直边框作为y轴,我们可以构建坐标系(坐标系)。球的位置是(0,0)。根据球的初始速度,你应该在时间t找到它的位置。(球的碰撞轨迹形成镜面反射。)
#include <algorithm>#include <iostream>#include <cstdio>#include <cmath>#include <cstring>using namespace std;const double PI = atan(1)*4;double judge(double x,double r){ int xans=(int)(x/(2*r)); x=x-r*2*xans; if(x>r) x=r-(x-r); return x;}int main(){ int T; scanf("%d",&T); while(T--) { double x,v,a,l,d,t,xx,yy,vx,vy; scanf("%lf%lf%lf%lf%lf",&v,&a,&l,&d,&t); x=v*t; xx=x*cos(a*PI/180);//转换成角度 xx=judge(xx,d); yy=x*sin(a*PI/180); yy=judge(yy,l); printf("(%.2lf,%.2lf)\n",xx,yy); } return 0;}
1463: Elastic Ball in the Frame
Time Limit: 2 Sec Memory Limit: 128 MBSubmit: 249 Solved: 72
[Submit][Status][Web Board]
Description
In a rectangular frame, there’s an elastic ball which can be regarded as a mass point(The ball can make elastic collisions with the frame).The frame lies on a smooth horizontal plane, and the initial position of the ball is at the lower left quarter(左下角)of the frame. Taking horizontal border as x axis and the vertical border as y axis, we can build the coordinate(坐标系). The position of the ball is (0,0).Given the ball’s initial speed, you are supposed to find its position at time t. (The collision trace of the ball forms a mirror reflection.)
Input
There is a positive integer n(n<1000) on the first line, representing the case number. There follows n lines, each line has 5 positive rational number, v(0<v<100), a(0<a<90), l(0<l<100), d(0<d<100),t(0<t<107),representing the ball’s initial speed, the intersection angle between the ball’s initial speed and the x axis, the length of the vertical border, the length of the horizontal border, and the queried time respectively.
Output
For each case, output the corresponding position in the (x,y) form, keeping two decimal places.
Sample Input
21 45 2 2 21 53.13 4 6 10
Sample Output
(1.41,1.41)(6.00,0.00)
HINT
Sample 1 and sample 2 are shown below.
Source
- Elastic Ball in the Frame(水题)
- 3018 问题 C: Elastic Ball in the Frame
- HDOJ 题目2277 Change the ball(水题,规律)
- Panel in the Frame,手动居中
- hdu 1556 Color the ball(水题)
- hdu(1556)Color the ball
- Color the ball (树状数组)
- HDU 1556 Color the ball (模拟)
- Color the ball(树状数组)
- Color the ball(杭电1556)
- HDU 1556 Color the ball(BIT)
- nyoj Change the ball 313 (技巧)
- Color the ball(树状数组)
- hdu1556 Color the ball(树状数组)
- hdu1556Color the ball(线段树)
- Color the ball(树状数组)
- 1556 Color the ball(分块)
- HDU1556 color the ball(前缀和)
- BIEE 11g 使用叙述视图实现复杂中国式表格一例
- USACO-Section1.2 dualpal[字符处理]
- IOS基础控件 UIImageView swift3.1
- Pascal中repeat的用法
- Java变量
- Elastic Ball in the Frame(水题)
- 深入浅出理解视频编码H264结构
- Q21_按之字形顺序打印二叉树
- 【数据压缩】JPEG编解码
- 归并排序
- WebAPI与传统的WebService有哪些不同
- 淘淘商城系列——首页轮播图展示
- 电脑(Linux/Windows)使用SSH远程登录安卓(Android)手机实现无线传输和管理文件(图文详解)
- lintcde80 中位数