UVA10387矩形内的无损碰撞
来源:互联网 发布:sqlplus连接远程数据库 编辑:程序博客网 时间:2024/05/21 22:21
这题利用分速度来理解,由于是无损碰撞所以速度大小不变,由于每次碰撞与水平方向的角度都是一样,所以分解为垂直方向速度与水平
方向速度,速度均不变,由于最后会回到起点,所以可以利用勾股定理求出实际行走的距离,水平方向距离为a*m,垂直距离方向为b*n;
然后由此求出距离,根据速度不变性原理和分解原理,速度初始角度即为行驶的水平距离和垂直距离的角度,利用atan即可求出然后注意转换成
角度。
#include<cstdio>#include<iostream>#include<vector>#include<queue>#include<algorithm>#include<string>#include<cstdlib>#include<map>#include<set>#include<cmath>#include<cstring>#include<cctype>#include<climits>#include<memory>#include<climits>#include<cstdlib>using namespace std;#define LL long long#define INT (1LL<<62);const double eps=1e-6;const double pi=4*atan(1.0);int dcmp(double x){ return fabs(x)<eps?0:(x>0?1:-1);}/*struct point{ double x,y; point() {}; point(double x,double y):x(x),y(y){}; point operator + (point b) { return point(x+b.x,y+b.y); } point operator - (point b) { return point(x-b.x,y-b.y); } point operator / (double b) { return point(x/b,y/b); } point operator * (double b) { return point(x*b,y*b); } void in() { cin>>x>>y; }};double dot(point a,point b){ return a.x*b.x+a.y*b.y;}double length(point a){ return sqrt(dot(a,a));}double dd(point a,point b){ return sqrt((b.x-a.x)*(b.x-a.x)+(b.y-a.y)*(b.y-a.y));}point zx(point a){ double d=length(a); return point(-a.y/d,a.x/d);}*/int main(){ double a,b,s,m,n; while(cin>>a>>b>>s>>m>>n&&(a||b||s||m||n)) { double x=a*m; double y=b*n; printf("%.2f %.2f\n",atan(y/x)*180/pi,sqrt(x*x+y*y)/s); } return 0;}
0 0
- UVA10387矩形内的无损碰撞
- UVA10387
- UVA10387
- uva10387
- 矩形碰撞
- 判断点是否在矩形内碰撞代码
- 小球在矩形框内45°碰撞问题
- cocos2d-x中矩形的碰撞检测
- 矩形碰撞检测的解释(转)
- 圆形和矩形的碰撞检测
- 圆与旋转矩形的碰撞检测
- 和旋转后的矩形碰撞
- 矩形与矩形碰撞2
- 提取矩形内的图像
- 矩形碰撞检测
- 矩形检测碰撞算法
- 矩形碰撞检测
- 圆,矩形碰撞检测
- Cocos2d-x开发教程 第六节 UI控件(Label)
- Spring(一):AOP
- 5行代码搞定floyd算法
- c#中的模态对话框和非模态对话框
- java读取目录下(包括子目录)的所有文件
- UVA10387矩形内的无损碰撞
- Random
- oracle 字符串中取数字
- Js学习第三天----字符集
- 编译报错解决。
- springMvc 将对象json返回时自动忽略掉对象中的特定属性的注解方式
- python正则表达式
- HDU 1873 看病要排队
- Path Sum II