zoukankan      html  css  js  c++  java
  • HDU_4036 Rolling Hongshu

       物理题,我把公式推错了。。。

      两个限制条件,1、能爬上最高坡。2、Sweet Potato在每一个有Bitter Potatoes位置的速度大于等于Bitter 的速度。

    设要求的初速度为pv

    1、pv = sqrt(2*g*(maxh - h0));

    2、pv = tpv = sqrt(vi*vi + 2*g*hi); 为bitter potato纵坐标。

    View Code
    #include <iostream>
    #include <cstring>
    #include <cstdio>
    #include <cmath>

    using namespace std;

    const int MAX = 1010;
    const double g = 20.0;

    struct Mot {
    double x;
    double h;
    } M[MAX];

    int main() {
    //freopen("data.in", "r", stdin);

    int T, n, m, i, j, cas = 0;
    double pv, tpv, x;
    double mi, vi, w, hi;
    scanf("%d", &T);
    while(T--) {
    scanf("%d%d%lf", &n, &m, &w);
    pv = 0;
    for(i = 0; i < n; ++i) {
    scanf("%lf%lf", &M[i].x, &M[i].h);
    if(M[i].h - M[0].h >= 0) {
    tpv = sqrt(2*g*(M[i].h - M[0].h));
    if(tpv > pv) pv = tpv;
    }
    }

    for(i = 0; i < m; ++i) {
    scanf("%lf%lf%lf", &x, &vi, &mi);
    x += M[0].x;
    for(j = 0; j < n; ++j) {
    if(M[j].x <= x && M[j + 1].x >= x) {
    hi = (M[j + 1].h - M[j].h)*(x - M[j].x)/(M[j + 1].x - M[j].x) + M[j].h;
    hi -= M[0].h;
    break;
    }
    }
    tpv = sqrt(vi*vi + 2*g*hi);
    if(tpv > pv) pv = tpv;
    }
    printf("Case %d: %.2lf\n", ++cas, pv);
    }
    return 0;
    }



  • 相关阅读:
    常用centos命令,经常忘记
    大数据hadoop之最简单理解
    企业级私有镜像仓库Harbor
    docker 修改国内源
    docker镜像仓库
    Dockerfile
    通过docker搭建LNMP平台(以wordpress为例)
    蓝鲸问题库
    docker常用命令
    LVS+Keepalive双机热备 <转>
  • 原文地址:https://www.cnblogs.com/vongang/p/2433437.html
Copyright © 2011-2022 走看看