UPC-物理课

山再高,往上爬,总能登顶;
路再长,走下去,定能到达。

物理课

题目描述

wzy正在上物理课!他发现了一个完全不会的题目:caoxia在一个奇妙的星球上(重力加速度为g)踢了一只猫,猫飞起的路线与地面夹角为θ(角度制),初速度为v,猫非常地开心,所以每次落地后会自己反弹,但反弹后速度会乘以一个常数d(0≤d<1)。请问猫最后的落点离起点多远?
(猫飞行时方向不会改变,飞行过程中不计空气阻力与摩擦力,所有数值单位均为国际标准单位制)
输入
第一行一个数T,代表有T组数据。接下来T行每行4个浮点数,分别为θ,v,d,g,保留到小数点后两位。
输出
共T行,每行一个浮点数表示猫离起点的距离,四舍五入到5位小数。

Sample Input

3
45 10 0.5 10
3.44 2.35 0.77 1.76
2.33 2.33 0.78 9.8

Sample Output

13.33333
0.92330
0.11493

Hint

如图所示,最终猫会停留在(40/3,0),距离原点距离约为13.33333.
在这里插入图片描述
0≤v≤1,000,0<g≤1,000,0≤d<1,0<θ<90,T≤50,000.

题目分析

这题,毋庸置疑,水题一个但是自己为啥wa了9遍之多?如果不是看到别人代码的π的值和我的不一样,恐怕得wa个99遍不止。
下次注意了,π的值要保证精度
在这里插入图片描述
这题呢就是一个物理题,咱们来推导一波

在这里插入图片描述

根据公式一波操作O(1)复杂度求解。还好高中的物理还没忘。。。。

AC时间到

#include<algorithm>
#include<iostream>
#include<string.h>
#include <iomanip>
#include<stdio.h>
#include<utility>
#include<vector>
#include<string>
#include<math.h>
#include<cmath>
#include<queue>
#include<stack>
#include<deque>
#include<map>
#pragma warning(disable:4244)
#define PI 3.141592653589793
#pragma GCC optimize(2)
#define accelerate cin.tie(NULL);cout.tie(NULL);ios::sync_with_stdio(false);
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll ll_inf = 9223372036854775807;
const int int_inf = 2147483647;
const short short_inf = 32767;
const char char_inf = 127;
ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }
inline ll read() {
    ll c = getchar(), Nig = 1, x = 0;
    while (!isdigit(c) && c != '-')c = getchar();
    if (c == '-')Nig = -1, c = getchar();
    while (isdigit(c))x = ((x << 1) + (x << 3)) + (c ^ '0'), c = getchar();
    return Nig * x;
}
inline void out(ll a) {
    if (a < 0)putchar('-'), a = -a;
    if (a >= 10)out(a / 10);
    putchar(a % 10 + '0');
}
ll phi(ll n)
{
    ll ans = n, mark = n;
    for (ll i = 2; i * i <= mark; i++)
        if (n % i == 0) { ans = ans * (i - 1) / i; while (n % i == 0)n /= i; }
    if (n > 1)ans = ans * (n - 1) / n; return ans;
}
ll qpow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1)res = (res * x) % mod;
        x = (x * x) % mod;
        n >>= 1;
    }
    return res;
}
#define Floyd for(int k = 1; k <= n; k++)for(int i=1;i<=n;i++)for(int j=1;j<=n;j++)
#define read read()
int main()
{
    int T = read;
    while (T--)
    {
        double a, v, k, g;
        scanf("%lf%lf%lf%lf", &a, &v, &k, &g);
        printf("%.5f\n", sin(2 * a / 180 * PI) * v * v / (g * (1 - k * k)));
    }
}

By-轮月

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Round moon

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值