URAL 1192. Ball in a Dream

来源:互联网 发布:守望先锋莫伊拉数据 编辑:程序博客网 时间:2024/05/16 12:28

水题一枚~~之前一直没怎么看懂题,事实证明。。。我想歪了。。。

开始一直没明白过来pi干吗用 = =。。直到样例过不去才发现了,输入是角度。。计算用的是弧度。。笨。。

给你速度和初始角度,每次落地减少为原来1/K的动能,求能跳到的最大距离。。

纯物理题。。


#include <set>#include <map>#include <queue>#include <stack>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <iostream>#include <limits.h>#include <string.h>#include <string>#include <algorithm>#define MID(x,y) ( ( x + y ) >> 1 )#define L(x) ( x << 1 )#define R(x) ( x << 1 | 1 )#define FOR(i,s,t) for(int i=(s); i<(t); i++)#define BUG puts("here!!!")#define STOP system("pause")#define file_r(x) freopen(x, "r", stdin)#define file_w(x) freopen(x, "w", stdout)using namespace std;const double pi = acos(-1.0);int main(){double v, a, k;while( ~scanf("%lf%lf%lf", &v, &a, &k) ){double sum = 0;a = a*pi/180;while( v > 0.01 )//经测试,这个上界最大为0.01.。。。 {double vx = v*sin(a);double vy = v*cos(a);double t = vy / 10.0;sum += vx * t * 2;v /= sqrt(k);}printf("%.2lf\n", sum);}return 0;}